Dates : improvements string recognition
Dates can now have one digit for month and day
This commit is contained in:
parent
5ff80cb233
commit
23a1397419
2 changed files with 5 additions and 5 deletions
|
@ -70,10 +70,10 @@ sub regexp ($;$) {
|
||||||
# way of saying "does this string match *whatever* format that Dates object is?"
|
# way of saying "does this string match *whatever* format that Dates object is?"
|
||||||
|
|
||||||
($format eq 'sql') and
|
($format eq 'sql') and
|
||||||
return qr/^(\d{4})(\d{2})(\d{2})(?:\s{4}(\d{2})(\d{2})(\d{2}))?/;
|
return qr/^(\d{4})(\d{1,2})(\d{1,2})(?:\s{4}(\d{2})(\d{2})(\d{2}))?/;
|
||||||
($format eq 'iso') and
|
($format eq 'iso') and
|
||||||
return qr/^(\d{4})$delim(\d{2})$delim(\d{2})(?:(?:\s{1}|T)(\d{2})\:?(\d{2})\:?(\d{2}))?Z?/;
|
return qr/^(\d{4})$delim(\d{1,2})$delim(\d{1,2})(?:(?:\s{1}|T)(\d{2})\:?(\d{2})\:?(\d{2}))?Z?/;
|
||||||
return qr/^(\d{2})$delim(\d{2})$delim(\d{4})(?:\s{1}(\d{2})\:?(\d{2})\:?(\d{2}))?/; # everything else
|
return qr/^(\d{1,2})$delim(\d{1,2})$delim(\d{4})(?:\s{1}(\d{1,2})\:?(\d{1,2})\:?(\d{1,2}))?/; # everything else
|
||||||
}
|
}
|
||||||
|
|
||||||
sub dmy_map ($$) {
|
sub dmy_map ($$) {
|
||||||
|
|
|
@ -19,8 +19,8 @@ sub describe ($$) {
|
||||||
# Keep the number of test elements per [array] equal or the predicted number of tests
|
# Keep the number of test elements per [array] equal or the predicted number of tests
|
||||||
# needs to be different for different (fake) sysprefs.
|
# needs to be different for different (fake) sysprefs.
|
||||||
my %thash = (
|
my %thash = (
|
||||||
iso => ['2001-01-01','1989-09-21','1952-01-00', '1989-09-21 13:46:02'],
|
iso => ['2001-1-1','1989-9-21','1952-1-0', '1989-9-21 13:46:02','2001-01-01','1989-09-21','1952-01-00', '1989-09-21 13:46:02'],
|
||||||
metric => ["01-01-2001",'21-09-1989','00-01-1952', '21-09-1989 13:46:02'],
|
metric => ["1-1-2001",'21-9-1989','00-1-1952', '21-9-1989 13:46:02',"01-01-2001",'21-09-1989','00-01-1952', '21-09-1989 13:46:02'],
|
||||||
us => ["01-01-2001",'09-21-1989','01-00-1952', '09-21-1989 13:46:02'],
|
us => ["01-01-2001",'09-21-1989','01-00-1952', '09-21-1989 13:46:02'],
|
||||||
sql => ['20010101 010101',
|
sql => ['20010101 010101',
|
||||||
'19890921 143907',
|
'19890921 143907',
|
||||||
|
|
Loading…
Reference in a new issue