Codebase list libdatetime-format-iso8601-perl / b4fd94b
Imported Upstream version 0.08 Salvatore Bonaccorso 12 years ago
13 changed file(s) with 144 addition(s) and 45 deletion(s). Raw diff Collapse all Expand all
00 Revision history for Perl module DateTime::Format::ISO8601
1
2 0.08 Sat Feb 11 23:40:43 MST 2012
3 - rt.cpan.org #52645 : UTC offsets must be in the same format
4 (basic|extended) as the time as to which it is attached.
15
26 0.07 Sun Jan 17 23:35:40 MST 2010
37 - fix test failures caused by tests using DateTime->now(), all tests should
1313 t/03_base_datetime.t
1414 t/04_legacy_year.t
1515 t/05_cut_off_year.t
16 t/06_bad_formats.t
1617 t/99_pod.t
18 META.json
0 {
1 "abstract" : "Parses ISO8601 formats",
2 "author" : [
3 "Joshua Hoblitt <jhoblitt@cpan.org>"
4 ],
5 "dynamic_config" : 1,
6 "generated_by" : "Module::Build version 0.38, CPAN::Meta::Converter version 2.112150",
7 "license" : [
8 "perl_5"
9 ],
10 "meta-spec" : {
11 "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
12 "version" : "2"
13 },
14 "name" : "DateTime-Format-ISO8601",
15 "prereqs" : {
16 "configure" : {
17 "requires" : {
18 "Module::Build" : "0.38"
19 }
20 },
21 "runtime" : {
22 "recommends" : {
23 "File::Find::Rule" : "0.24",
24 "Test::Distribution" : "1.22",
25 "Test::Pod" : "0.95"
26 },
27 "requires" : {
28 "DateTime" : "0.18",
29 "DateTime::Format::Builder" : "0.77"
30 }
31 }
32 },
33 "provides" : {
34 "DateTime::Format::ISO8601" : {
35 "file" : "lib/DateTime/Format/ISO8601.pm",
36 "version" : "0.08"
37 }
38 },
39 "release_status" : "stable",
40 "resources" : {
41 "license" : [
42 "http://dev.perl.org/licenses/"
43 ]
44 },
45 "version" : "0.08"
46 }
00 ---
1 name: DateTime-Format-ISO8601
2 version: 0.07
1 abstract: 'Parses ISO8601 formats'
32 author:
43 - 'Joshua Hoblitt <jhoblitt@cpan.org>'
5 abstract: Parses ISO8601 formats
4 build_requires: {}
5 configure_requires:
6 Module::Build: 0.38
7 dynamic_config: 1
8 generated_by: 'Module::Build version 0.38, CPAN::Meta::Converter version 2.112150'
69 license: perl
7 resources:
8 license: http://dev.perl.org/licenses/
9 requires:
10 DateTime: 0.18
11 DateTime::Format::Builder: 0.77
10 meta-spec:
11 url: http://module-build.sourceforge.net/META-spec-v1.4.html
12 version: 1.4
13 name: DateTime-Format-ISO8601
14 provides:
15 DateTime::Format::ISO8601:
16 file: lib/DateTime/Format/ISO8601.pm
17 version: 0.08
1218 recommends:
1319 File::Find::Rule: 0.24
1420 Test::Distribution: 1.22
1521 Test::Pod: 0.95
16 configure_requires:
17 Module::Build: 0.35
18 provides:
19 DateTime::Format::ISO8601:
20 file: lib/DateTime/Format/ISO8601.pm
21 version: 0.07
22 generated_by: Module::Build version 0.35
23 meta-spec:
24 url: http://module-build.sourceforge.net/META-spec-v1.4.html
25 version: 1.4
22 requires:
23 DateTime: 0.18
24 DateTime::Format::Builder: 0.77
25 resources:
26 license: http://dev.perl.org/licenses/
27 version: 0.08
0 # Note: this file was auto-generated by Module::Build::Compat version 0.35
1
0 # Note: this file was auto-generated by Module::Build::Compat version 0.3800
1
22 unless (eval "use Module::Build::Compat 0.02; 1" ) {
33 print "This module requires Module::Build to install itself.\n";
4
4
55 require ExtUtils::MakeMaker;
66 my $yn = ExtUtils::MakeMaker::prompt
77 (' Install Module::Build now from CPAN?', 'y');
8
8
99 unless ($yn =~ /^y/i) {
1010 die " *** Cannot install without Module::Build. Exiting ...\n";
1111 }
12
12
1313 require Cwd;
1414 require File::Spec;
1515 require CPAN;
16
16
1717 # Save this 'cause CPAN will chdir all over the place.
1818 my $cwd = Cwd::cwd();
19
19
2020 CPAN::Shell->install('Module::Build::Compat');
2121 CPAN::Shell->expand("Module", "Module::Build::Compat")->uptodate
2222 or die "Couldn't install Module::Build, giving up.\n";
23
23
2424 chdir $cwd or die "Cannot chdir() back to $cwd: $!";
2525 }
2626 eval "use Module::Build::Compat 0.02; 1" or die $@;
2727
2828 Module::Build::Compat->run_build_pl(args => \@ARGV);
29 my $build_script = 'Build';
29 my $build_script = 'Build';
3030 $build_script .= '.com' if $^O eq 'VMS';
3131 exit(0) unless(-e $build_script); # cpantesters convention
3232 require Module::Build;
00 # Copyright (C) 2003-2005 Joshua Hoblitt
1 #
2 # $Id: ISO8601.pm,v 1.25 2010/01/18 06:36:21 jhoblitt Exp $
31
42 package DateTime::Format::ISO8601;
53
75 use warnings;
86
97 use vars qw( $VERSION );
10 $VERSION = '0.07';
8 $VERSION = '0.08';
119
1210 use Carp qw( croak );
1311 use DateTime;
676674 },
677675 {
678676 #YYYYMMDDThhmmss.ss[+-]hhmm 19850412T101530.5+0100 20041020T101530.5-0500
677 regex => qr/^ (\d{4}) (\d\d) (\d\d)
678 T?? (\d\d) (\d\d) (\d\d) [\.,] (\d+)
679 ([+-] \d\d \d\d) $/x,
680 params => [ qw( year month day hour minute second nanosecond time_zone ) ],
681 postprocess => [
682 \&_fractional_second,
683 \&_normalize_offset,
684 ],
685 },
686 {
679687 #YYYY-MM-DDThh:mm:ss.ss[+-]hh:mm 1985-04-12T10:15:30.5+01:00 1985-04-12T10:15:30.5-05:00
680 regex => qr/^ (\d{4}) -?? (\d\d) -?? (\d\d)
681 T?? (\d\d) :?? (\d\d) :?? (\d\d) [\.,] (\d+)
682 ([+-] \d\d :?? \d\d) $/x,
688 regex => qr/^ (\d{4}) - (\d\d) - (\d\d)
689 T?? (\d\d) : (\d\d) : (\d\d) [\.,] (\d+)
690 ([+-] \d\d : \d\d) $/x,
683691 params => [ qw( year month day hour minute second nanosecond time_zone ) ],
684692 postprocess => [
685693 \&_fractional_second,
00 #!/usr/bin/env perl
11
22 # Copyright (C) 2005 Joshua Hoblitt
3 #
4 # $Id: 00_distribution.t,v 1.1 2007/04/11 01:17:16 jhoblitt Exp $
53
64 use strict;
75 use warnings FATAL => qw( all );
00 #!/usr/bin/perl
11
22 # Copyright (C) 2003-2005 Joshua Hoblitt
3 #
4 # $Id: 01_load.t,v 1.5 2007/04/11 01:11:42 jhoblitt Exp $
53
64 use strict;
75 use warnings;
00 #!/usr/bin/perl
11
22 # Copyright (C) 2003-2005 Joshua Hoblitt
3 #
4 # $Id: 02_examples.t,v 1.11 2010/01/18 06:36:23 jhoblitt Exp $
53
64 use strict;
75 use warnings;
00 #!/usr/bin/perl
11
22 # Copyright (C) 2005 Joshua Hoblitt
3 #
4 # $Id: 03_base_datetime.t,v 1.4 2007/04/11 01:11:42 jhoblitt Exp $
53
64 use strict;
75 use warnings;
00 #!/usr/bin/perl
11
22 # Copyright (C) 2005 Joshua Hoblitt
3 #
4 # $Id: 04_legacy_year.t,v 1.3 2007/04/11 01:11:42 jhoblitt Exp $
53
64 use strict;
75 use warnings;
00 #!/usr/bin/perl
11
22 # Copyright (C) 2005 Joshua Hoblitt
3 #
4 # $Id: 05_cut_off_year.t,v 1.3 2007/04/11 01:11:42 jhoblitt Exp $
53
64 use strict;
75 use warnings;
0 #!/usr/bin/perl
1
2 # Copyright (C) 2003-2012 Joshua Hoblitt
3
4 use strict;
5 use warnings;
6
7 use lib qw( ./lib );
8
9 use Test::More tests => 4;
10
11 use DateTime::Format::ISO8601;
12
13 # parse_datetime
14 my $base_year = 2000;
15 my $base_month = "01";
16 my $iso8601 = DateTime::Format::ISO8601->new(
17 base_datetime => DateTime->new( year => $base_year, month => $base_month ),
18 );
19
20 # examples from https://rt.cpan.org/Ticket/Update.html?id=5264
21
22 #Section 4.2.5.1 says "Expressions of the difference between local time and UTC
23 #of day are a component in the representations defined in 4.2.5.2; they shall
24 #not be used as self-standing expressions.". Which means the UTC offset is
25 #considered part of the time format so you get to use the extended formation
26 #(the ':') or not but you can't mix and match the two.
27
28 eval {
29 my $dt = $iso8601->parse_datetime( '2009-12-10T09:00:00.00+0100' );
30 };
31 like( $@, qr/Invalid date format/ );
32
33 eval {
34 my $dt = $iso8601->parse_datetime( '2011-07-04T20:50:23+0200' );
35 };
36 like( $@, qr/Invalid date format/ );
37
38 # more "colon or not" coverage
39 eval {
40 my $dt = $iso8601->parse_datetime( '20091210T090000.00+01:00' );
41 };
42 like( $@, qr/Invalid date format/ );
43
44 eval {
45 my $dt = $iso8601->parse_datetime( '20110704T205023+02:00' );
46 };
47 like( $@, qr/Invalid date format/ );