# New Ticket Created by Alex Jakimenko
# Please include the string: [perl #125681]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org/Ticket/Display.html?id=125681 >
Code:
say Date.new("0000-01-01").truncated-to('week');
say Date.new("0000-01-01").pred();
say Date.new("0000-01-01") - 10000;
Result:
-001-12-27
-001-12-31
-028-08-15
It seems like ISO 8601 allows negative dates, but it should be -0001-12-31.
“by convention 1 BC is labelled +0000, 2 BC is labeled -0001, and so on.”
(from https://en.wikipedia.org/wiki/ISO_8601)
Similarly,
Code:
say Date.new("9900-01-01") + 100000
Result:
10173-10-16
it's OK, but “An expanded year representation [±*Y*YYYY] must have an
agreed-upon number of extra year digits beyond the four-digit minimum, and
it must be prefixed with a + or − sign”.
If I got that right, then it should be +10173-10-16
That being said, I think that the whole thing that is not within 0000-9999
boundary is bound to cause errors, even if Perl6 will ever get it right.
Most naive approaches to parse dates will split by '-' which will break
horribly if the date starts with - sign.
And even Date.new() does not allow to pass anything but yyyy-mm-dd.