Closed worthmine closed 3 years ago
That's definitely a bug in the synopsis. The parse_time
method will only accept times, like 12:13:14
, not a full datetime.
thank you for fast replying!
it still strange because:
my $dt = DateTime::Format::ISO8601->parse_datetime($str);
( undef, my $time ) = split 'T', $dt;
#$time =~ s/://g; # it seems this line is required to pass
say 'parse_time: ', $dt = DateTime::Format::ISO8601->parse_time($time);
# said "Invalid date format: 11:32:31 at ~"
That looks like a separate bug. The parse_time
method should be able to parse that format, but for some reason it's not.
I'm not in a hurry, but when will it be fixed?
I'd certainly welcome a PR to fix these issues. Otherwise it'll be whenever I get around to it. Typically I do FOSS stuff on weekends, so maybe this weekend.
I'd like to try to fix it indeed. but I'm busy until this Thursday 15. Probably, I'll wait for your fix your own.
best regard.
So I did some more digging and I realized parse_time
is working as intended. That method is only used for formats which might be either a date or a time. The parse_time
method treats those as a time, whereas parse_datetime
will treat them as a date.
Fixed in 0.15.
Thank you for fast fixing. Lastly, I have a question about README.
At 5.3 Time of Day,
there is a mention to the format 'hh:mm:ss' as chapter 5.3.1.1,
but it still fails to parse this format with parse_time()
.
use feature qw(say);
use DateTime::Format::ISO8601;
my $time_str = '23:32:31';
$dt = DateTime::Format::ISO8601->parse_time($time_str); # dies here
say $dt;
Is this a spec?
I read the source, it seems $time_str must be like/^T?(?:\d\d){1,3}$/
think it will be more strictly based on ISO 8601 if parse_time()
can accept the format like /T?\d\d(?::?\d\d){0,2}Z?$/
Hi, I've met something strange.
At the SYNOPSIS,
when I run it within my test script, It says
Invalid date format: 2020-07-25T11:32:31 ~
and dies at the end of lines. It is strange.And, I succeeded to pass this situation like this:
In DateTime, there is no definition for
parse_time
. And there is no document forparse_time
.What does
parse_time
mean?