Twig icon indicating copy to clipboard operation
Twig copied to clipboard

Date error - Failed to parse time string (-001-11-30T00:00:00-05:00) at position 7 (-): Double timezone specification")

Open jakraska opened this issue 13 years ago • 2 comments

I just upgraded From twig v1.14.0 to v1.14.1 and i now get the following error:

An exception has been thrown during the rendering of a template ("DateTime::__construct(): Failed to parse time string (-001-11-30T00:00:00-05:00) at position 7 (-): Double timezone specification")

The markup i'm using is simply:

{{ user.created|date('m/d/Y') }}

The data that it is failing on is loaded from a datetime field with value 0000-00-00 00:00:00

public 'created' (Object) stdClass
   public '__CLASS__' (String, 8 characters ) DateTime
   public 'date' (String, 25 characters ) -001-11-30T00:00:00-05:00
   public 'timezone' (String, 16 characters ) America/New_York

I'm assuming this problem has to do with the added support for PHP 5.5 DateTimeInterface in 14.1

jakraska avatar Oct 17 '13 22:10 jakraska

Is '11/30/-0001' your expected result of {{ user.created|date('m/d/Y') }}, or any other?

hidenorigoto avatar Oct 18 '13 08:10 hidenorigoto

I didn't have any specific expectations since its a garbage date anyway. As long as it doesn't crash, whatever you think is the most logical output is great. Thanks!

jakraska avatar Oct 18 '13 14:10 jakraska