Suggestion #9051

DateTimeViewHelper

Added by Christian Zenker about 9 years ago. Updated over 7 years ago.

Status:
New
Priority:
Should have
Assignee:
-
Start date:
2010-07-27
Due date:
% Done:

0%

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.

source:DateTimeViewHelper/_Extension/trunk

History

#1 Updated by Thomas Deinhamer about 9 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 9 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 7 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.

Also available in: Atom PDF