Hi all,

The doc for Regexp::Common::time ISO8601 datetimes states:

However the standard for an ISO8601 datetime appears to additionally require that if a separator is used for the date or the time, a separator must also be used for the other component. I cannot find a spec that states this, but read on ...

Demonstrated with DateTime::Format::ISO8601 :

$ perl -Mstrict -MRegexp::Common=time -MDateTime::Format::ISO8601 -wE +' my $str = "2018-03-01T110601Z"; say "DateTime::Format: ", eval { my $dt = DateTime::Format::ISO8601->p +arse_datetime($str) } ? "valid" : "not valid: $@"; say "Regexp::Common: ", $str =~ /$RE{time}{iso}/ ? "valid" : "not vali +d"; ' DateTime::Format: not valid: Invalid date format: 2018-03-01T110601Z a +t -e line 3. eval {...} called at -e line 3 Regexp::Common: valid

Control:

$ perl -Mstrict -MRegexp::Common=time -MDateTime::Format::ISO8601 -wE +' my $str = "2018-03-01T11:06:01Z"; say "DateTime::Format: ", eval { my $dt = DateTime::Format::ISO8601->p +arse_datetime($str) } ? "valid" : "not valid: $@"; say "Regexp::Common: ", $str =~ /$RE{time}{iso}/ ? "valid" : "not vali +d"; ' DateTime::Format: valid Regexp::Common: valid

Which is right?


The way forward always starts with a minimal test.

In reply to Does ISO8601 require a separator in the time if one is used in the date? by 1nickt

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.