Suggestion #9051
DateTimeViewHelper
Status: | New | Start date: | 2010-07-27 | |
---|---|---|---|---|
Priority: | Should have | Due date: | ||
Assigned To: | - | % Done: | 0% |
|
Category: | - | |||
Target version: | - | |||
Has patch: | No | Tags: |
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.
History
#1 Updated by Thomas Deinhamer about 5 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
#2 Updated by Christian Zenker about 5 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.
#3 Updated by Christopher Hlubek over 3 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
.