Bug 24643: Support fractional seconds

This patch allows dt_from_string to handle RFC3339 strings containing
fractional seconds up to one thousandth of a second.

Test plan:

- Apply patch
- prove t/DateUtils.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Andrew Isherwood 2020-02-12 16:04:07 +00:00 committed by Martin Renvoize
parent ac8d607411
commit a8a9512ff6
Signed by: martin.renvoize
GPG key ID: 422B469130441A0F

View file

@ -117,7 +117,7 @@ sub dt_from_string {
(?<minute>\d{2}) (?<minute>\d{2})
: :
(?<second>\d{2}) (?<second>\d{2})
(([Zz])|([\+|\-]([01][0-9]|2[0-3]):[0-5][0-9])) (\.\d{1,3})?(([Zz])|([\+|\-]([01][0-9]|2[0-3]):[0-5][0-9]))
/xms; /xms;
} }
elsif ( $date_format eq 'iso' or $date_format eq 'sql' ) { elsif ( $date_format eq 'iso' or $date_format eq 'sql' ) {