Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bad DateTime.Str output for years >9999 and -999 to -1 #4912

Closed
p6rt opened this issue Dec 23, 2015 · 5 comments
Closed

bad DateTime.Str output for years >9999 and -999 to -1 #4912

p6rt opened this issue Dec 23, 2015 · 5 comments

Comments

@p6rt
Copy link

p6rt commented Dec 23, 2015

Migrated from rt.perl.org#127007 (status was 'resolved')

Searchable as RT127007$

@p6rt
Copy link
Author

p6rt commented Dec 23, 2015

From zefram@fysh.org

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

@p6rt
Copy link
Author

p6rt commented Dec 23, 2015

From @lizmat

On 24 Dec 2015, at 00​:08, Zefram (via RT) <perl6-bugs-followup@​perl.org> wrote​:

# 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-archive.perl.org/perl6/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.

Fixed with 895546990f6001a5999ef , tests added with 0fa2c59924a35bb41e792

Can be closed.

Liz

@p6rt
Copy link
Author

p6rt commented Dec 23, 2015

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Dec 31, 2015

From @usev6

On Wed Dec 23 15​:52​:29 2015, elizabeth wrote​:

Fixed with 895546990f6001a5999ef , tests added with
0fa2c59924a35bb41e792

Can be closed.

Great! I'm closing the ticket as 'resolved'.

@p6rt
Copy link
Author

p6rt commented Dec 31, 2015

@usev6 - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant