Subject: | Standalone Time Format |
Add 01:12:14PM and 01:12:14 PM as standalone time formats.
Subject: | DT::F::F.patch |
Only in DateTime-Format-Flexible-new/: blib
diff -cr DateTime-Format-Flexible-0.29/lib/DateTime/Format/Flexible.pm DateTime-Format-Flexible-new/lib/DateTime/Format/Flexible.pm
*** DateTime-Format-Flexible-0.29/lib/DateTime/Format/Flexible.pm 2018-02-22 02:13:41.000000000 -0500
--- DateTime-Format-Flexible-new/lib/DateTime/Format/Flexible.pm 2018-02-24 19:17:45.314393777 -0500
***************
*** 333,338 ****
--- 333,349 ----
########################################################
##### bare times
+ # HH:MM:SS pm
+ { length => [7..11],
+ params => [ qw( hour minute second ampm ) ] ,
+ regex => qr{\A$HMS\s?$AMPM\z} ,
+ postprocess => [sub {
+ my %args = @_;
+ $args{parsed}{year} = __PACKAGE__->base->year;
+ $args{parsed}{month} = __PACKAGE__->base->month;
+ $args{parsed}{day} = __PACKAGE__->base->day;
+ }, \&_fix_ampm ]
+ },
# HH:MM:SS
{ length => [5..8],
params => [ qw( hour minute second ) ] ,
diff -cr DateTime-Format-Flexible-0.29/t/time.t DateTime-Format-Flexible-new/t/time.t
*** DateTime-Format-Flexible-0.29/t/time.t 2017-03-23 13:09:20.000000000 -0400
--- DateTime-Format-Flexible-new/t/time.t 2018-02-24 19:18:12.498494968 -0500
***************
*** 4,10 ****
use warnings;
use lib '.';
! use Test::More tests => 20;
use DateTime;
use t::lib::helper;
--- 4,10 ----
use warnings;
use lib '.';
! use Test::More tests => 22;
use DateTime;
use t::lib::helper;
***************
*** 13,18 ****
--- 13,20 ----
t::lib::helper::run_tests(
"23:59:59 => ${today}T23:59:59" ,
+ "01:58:59 PM => ${today}T13:58:59" ,
+ "01:58:59PM => ${today}T13:58:59" ,
"23:59 => ${today}T23:59:00" ,
"1:00 a.m. => ${today}T01:00:00" ,
"00:00 => ${today}T00:00:00" ,