The RFC3339 spec (https://www.ietf.org/rfc/rfc3339.txt) says that the second component of a date/time can contain fractions of a second, e.g. 2011-10-05T14:48:00.000Z This is the format returned by Javascript's toISOString() function. Unfortunately, when dt_from_string encounters a string in this format, it effectively drops the time component entirely and you end up with: 2011-10-05T00:00:00Z The problem lies in the regex that attempts to match the string when dt_from_string is called with the 'rfc3339' parameter. Adding support for optional fractions is straightforward.
Created attachment 98762 [details] [review] 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
Created attachment 98763 [details] [review] Add unit tests
Created attachment 98764 [details] [review] Bug 24643: Add unit tests
Created attachment 98780 [details] [review] 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>
Created attachment 98781 [details] [review] Bug 24643: Add unit tests https://bugs.koha-community.org/show_bug.cgi?id=24643 Signed-off-by: David Nind <david@davidnind.com>
Created attachment 98825 [details] [review] 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>
Created attachment 98826 [details] [review] Bug 24643: Add unit tests Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Created attachment 98827 [details] [review] Bug 24643: Add test to cover the timezone Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Nice work everyone! Pushed to master for 20.05
Pushed to 19.11.x branch for 19.11.04
backported to 19.05.x for 19.05.09