Coder Social home page Coder Social logo

datetime-format-iso8601's People

Contributors

autarch avatar domm avatar draxil avatar jhoblitt avatar lbjw avatar preaction avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

datetime-format-iso8601's Issues

Can't locate object method "year_length" via package "DateTime"

The test suite fails on some of my smokers:

Can't locate object method "year_length" via package "DateTime" at /home/cpansand/.cpan/build/2020081520/DateTime-Format-ISO8601-0.13-0/blib/lib/DateTime/Format/ISO8601.pm line 1051, <DATA> line 1.
# Tests were run but no plan was declared and done_testing() was not seen.
# Looks like your test exited with 255 after test #15.
# Seeded srand with seed '20200815' from local date.
t/base-datetime.t ...... 
Dubious, test returned 255 (wstat 65280, 0xff00)
All 15 subtests passed 
... (etc) ...

Probably this happens if DateTime is too old:

****************************************************************
Regression 'mod:DateTime'
****************************************************************
Name           	       Theta	      StdErr	 T-stat
[0='const']    	      0.0000	      0.0000	   1.17
[1='eq_1.36']  	      0.0000	      0.0000	   0.50
[2='eq_1.50']  	      1.0000	      0.0000	4697787031687232.00
[3='eq_1.51']  	      1.0000	      0.0000	5119294732350137.00
[4='eq_1.52']  	      1.0000	      0.0000	5197286303049295.00

R^2= 1.000, N= 74, K= 5
****************************************************************

Is the SYNOPSIS wrong?

Hi, I've met something strange.

At the SYNOPSIS,

use DateTime::Format::ISO8601;
 
my $str = '2020-07-25T11:32:31';
 
my $dt = DateTime::Format::ISO8601->parse_datetime($str);
$dt = DateTime::Format::ISO8601->parse_time($str);
...

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:

my $str = '2020-07-25T11:32:31';
say 'parse_datetime: ', my $dt = DateTime::Format::ISO8601->parse_datetime($str);
# parse_datetime: 2020-07-25T11:32:31    # correct

( undef, my $time ) = split 'T', $dt;
$time =~ s/://g;
say 'parse_time: ', $dt = DateTime::Format::ISO8601->parse_time($time);
# parse_time: 2020-10-12T11:32:31            # is it correct?

In DateTime, there is no definition for parse_time.
And there is no document for parse_time.

What does parse_time mean?

"-00:00" isn't standard-conforming

Migrated from rt.cpan.org #77535 (status was 'open')

Requestors:

Attachments:

From [email protected] on 2012-05-30 15:45:47
:

DateTime::Format::ISO8601, when parsing, allows a zero timezone offset
to be given with either sign:

$ perl -MDateTime::Format::ISO8601 -lwe 'print +DateTime::Format::ISO8601->parse_datetime("2000-01-01T12:00:00+00:00")'
2000-01-01T12:00:00
$ perl -MDateTime::Format::ISO8601 -lwe 'print +DateTime::Format::ISO8601->parse_datetime("2000-01-01T12:00:00-00:00")'
2000-01-01T12:00:00

ISO 8601 actually only allows "+" here, not "-". See the explanation
for the plus-or-minus sign in ISO 8601:2000 clause 5.1.1 or ISO 8601:2004
clause 3.4.2. The parsing function should reject "-" just as it rejects
"!".

-zefram

Bug in _fix_1_digit_year

Migrated from rt.cpan.org #53344 (status was 'open')

Requestors:

From [email protected] on 2010-01-04 16:48:10
:

Hi,

Due to the way _fix_1_digit_year is written, it sets the year incorrectly after
2010. I spotted this today when I noticed the tests failing (lines 231, 239,
247, and 254 in 02_examples.t).

As a suggestion, imo it would be better to add the parsed year instead of using
the regular expression and string concatenation.

Cheers,

Pedro

support for YYYY-MM-DDThh:mm:ss.ss[+-]hh

Migrated from rt.cpan.org #130682 (status was 'open')

Requestors:

From [email protected] (@domm) on 2019-10-09 19:15:48
:

Hi!

Is there any reason that there is support for

YYYY-MM-DDThh:mm:ss[+-]hh:mm
YYYY-MM-DDThh:mm:ss[+-]hh
YYYY-MM-DDThh:mm:ss.ss[+-]hh:mm

but NOT for
YYYY-MM-DDThh:mm:ss.ss[+-]hh

i.e. a string with miliseconds and only an hour offset is not parsable:

perl -MDateTime::Format::ISO8601 -E 'say DateTime::Format::ISO8601->parse_datetime("2019-10-09T21:07:10.42+02")'

PostgreSQLs now() functions returns strings with fractions of seconds and an hour only time-zone:

select now();
2019-10-09 21:10:21.14294+02

I guess it wouldn't be too hard to implement, and I would supply a patch, if this format would be supported...

Greetings,
domm

String with TZ -0700 fails to parse, unless..

Migrated from rt.cpan.org #108082 (status was 'open')

Requestors:

From [email protected] on 2015-10-29 14:38:23
:

From Facebook's Graph API: "2011-04-30T10:00:00-0700" fails to parse in v0.08:

perl -MDateTime::Format::ISO8601 -le'print DateTime::Format::ISO8601->new()->parse_datetime("2011-04-30T10:00:00-0700")'
Invalid date format: 2011-04-30T10:00:00-0700 at -e line 1.

If I change "length" in this section:

            {
                #YYYYMMDDThhmmss[+-]hhmm 19850412T101530+0400
                #YYYY-MM-DDThh:mm:ss[+-]hh:mm 1985-04-12T10:15:30+04:00
                length => [ qw( 20 25 ) ],
                regex  => qr/^ (\d{4}) -??  (\d\d) -?? (\d\d)
                            T (\d\d) :?? (\d\d) :?? (\d\d) ([+-] \d\d :?? \d\d) $/x,
                params => [ qw( year month day hour minute second time_zone ) ],
                postprocess => \&_normalize_offset,
            },

to:

                length => [ qw( 20 24 25 ) ],

then it parses fine..

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.