Skip to content
Permalink
Browse files

Add strftime() support to CakeTime::timeAgoInWords()

When an absolute date is generated CakeTime will automatically use
strftime() if the format string contains %. This allows for simpler
localization.

Refs #4550
  • Loading branch information...
mstra001 authored and markstory committed Sep 9, 2014
1 parent d715c6f commit 244acc724de547878345cec6003890b2f4ae8ca7
Showing with 5 additions and 1 deletion.
  1. +5 −1 lib/Cake/Utility/CakeTime.php
@@ -796,7 +796,11 @@ public static function timeAgoInWords($dateTime, $options = array()) {
}
if ($diff > abs($now - self::fromString($end))) {
return sprintf($absoluteString, date($format, $inSeconds));
return sprintf($absoluteString,
(strpos($format, '%') === false) ?
date($format, $inSeconds) :
self::_strftime($format, $inSeconds)
);
}
// If more than a week, then take into account the length of months

0 comments on commit 244acc7

Please sign in to comment.
You can’t perform that action at this time.