> On 23 Dec 2015, at 23:07, Zefram (via RT) <[email protected]>
> wrote:
>
> # New Ticket Created by Zefram
> # Please include the string: [perl #127002]
> # in the subject line of all future correspondence about this issue.
> # <URL: https://rt.perl.org/Ticket/Display.html?id=127002 >
>
>
> The documentation for DateTime.new says that when given a string input
> the string is to be in ISO 8601 format, and that an exception will be
> thrown when it is given an invalid string input. In fact it accepts
> some non ISO 8601 strings:
>
> "2000-01-01T00:00:00+0000" (mixed basic and extended representations)
> "2000-01-01T00:00:00-00" (wrong sign for zero timezone)
> "2000-01-0\x[666]T00:00:00" (non-ASCII digit)
>
> The first two failures are specific to the timezone portion of the string.
> Non-ASCII digits are accepted in all digit positions.
I tend to say ENOTABUG, as they are cases of “be liberal in what you accept”
and they match the regular expression. If they wouldn’t match that, *then* an
exception would be thrown.
$ 6 'DateTime.new("2000-01-01T00:00:00+0000").say'
2000-01-01T00:00:00Z
$ 6 'DateTime.new(“2000-01-01T00:00:00-00").say'
2000-01-01T00:00:00Z
$ 6 'DateTime.new("2000-01-0\x[666]T00:00:00").say'
2000-01-06T00:00:00Z
They all seem to generate the correct DateTime object. Note that if there is
an error:
$ 6 'DateTime.new("2000-01-0\x[666]T00:00:90").say'
Second out of range. Is: 90, should be in ^61
$ 6 'DateTime.new("2000-01-0\x[666]TOOMUCH").say'
Invalid DateTime string '2000-01-0٦TOOMUCH'; use an ISO 8601 timestamp
(yyyy-mm-ddThh:mm:ssZ or yyyy-mm-ddThh:mm:ss+01:00) instead
Liz