Révision ee46a8ed
Ajouté par Assos Assos il y a plus de 7 ans
drupal7/sites/all/modules/date/date_api/theme/theme.inc | ||
---|---|---|
194 | 194 |
function theme_date_time_ago($variables) { |
195 | 195 |
$start_date = $variables['start_date']; |
196 | 196 |
$end_date = $variables['end_date']; |
197 |
$use_end_date = isset($variables['use_end_date']) ? $variables['use_end_date'] : false; |
|
197 | 198 |
$interval = !empty($variables['interval']) ? $variables['interval'] : 2; |
198 | 199 |
$display = isset($variables['interval_display']) ? $variables['interval_display'] : 'time ago'; |
199 | 200 |
|
... | ... | |
202 | 203 |
return; |
203 | 204 |
} |
204 | 205 |
|
206 |
// We use the end date only when the option is checked. |
|
207 |
if ($use_end_date){ |
|
208 |
$date = date_format($end_date, DATE_FORMAT_UNIX); |
|
209 |
} |
|
210 |
else { |
|
211 |
$date = date_format($start_date, DATE_FORMAT_UNIX); |
|
212 |
} |
|
213 |
|
|
205 | 214 |
// Time to compare dates to. |
215 |
|
|
206 | 216 |
$now = date_format(date_now(), DATE_FORMAT_UNIX); |
207 |
$start = date_format($start_date, DATE_FORMAT_UNIX); |
|
208 | 217 |
|
209 | 218 |
// Will be positive for a datetime in the past (ago), and negative for a datetime in the future (hence). |
210 |
$time_diff = $now - $start;
|
|
219 |
$time_diff = $now - $date;
|
|
211 | 220 |
|
212 | 221 |
// Uses the same options used by Views format_interval. |
213 | 222 |
switch ($display) { |
Formats disponibles : Unified diff
Update date 7.x-2.9 -> 7.x-2.10-rc1