Suggestion #9051
DateTimeViewHelper
0%
Description
The current DateViewHelper has no support for localized dates so I created a version that uses strftime() to render strings.
Additionally it supports UNIX-timestamps, dates that are understood by strtotime() (i.e. "2010-07-27") and DateTime-objects.
And you can also calculate dates relative to the given one. This way you can add days, weeks, months or whatsoever or get the first day of a week, a month or a year.
Keen on hearing your opinion.
Updated by Thomas Deinhamer almost 12 years ago
Hoi! Just my 2 cents:
- Maybe it would be better to name the method 'normalizeTimestamp' instead of 'cleanTimestamp'.
- On line 110 you trim the string to find out if it is valid. Maybe 'is_numeric' does a better job?!
Regards,
Thomas
Updated by Christian Zenker almost 12 years ago
Both issues are changed. I always thought is_numeric()
does just check for integer and float - but it looks much better this way.
Updated by Christopher Hlubek over 10 years ago
- Has patch set to No
The ViewHelper is pretty helpful and should be included in the Fluid core since DateFormat->format()
is not suitable for localized output of names. But it should call $this->renderChildren
to use it as a shorthand filter if $timestamp === NULL
.