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
This commit is contained in:
mstra001 2014-09-09 12:03:01 +02:00 committed by mark_story
parent d715c6f2de
commit 244acc724d

View file

@ -796,7 +796,11 @@ class CakeTime {
}
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