# New Ticket Created by  Zefram 
# Please include the string:  [perl #127007]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=127007 >


DateTime.Str is documented to produce output in ISO 8601 format by
default, but the formatting of some year numbers outside the range 0 to
9999 inclusive is faulty.  The expanded representation that is required
is governed by ISO 8601:2004 clause 4.1.2.4.  Firstly, for year numbers
>9999, the use of a leading sign is mandatory with year numbers of five
or more digits, but the sign is being omitted:

> DateTime.new(:year(10000)).Str
10000-01-01T00:00:00Z
> DateTime.new(:year(54321)).Str
54321-01-01T00:00:00Z
> DateTime.new(:year(654321)).Str
654321-01-01T00:00:00Z

Secondly, for year numbers -999 to -1 inclusive, it is mandatory to use
at least four digits, but only three are being used:

> DateTime.new(:year(-999)).Str
-999-01-01T00:00:00Z
> DateTime.new(:year(-1)).Str
-001-01-01T00:00:00Z

The representation is correct for years <-999 and years 0 to 9999
inclusive.

-zefram

Reply via email to