Bug 19222

Summary: Why does dt_from_string not understand yyyy-mm-ddThh:mm:ss ?
Product: Koha Reporter: Marcel de Rooy <m.de.rooy>
Component: Architecture, internals, and plumbingAssignee: Marcel de Rooy <m.de.rooy>
Status: RESOLVED LATER QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: jonathan.druart, mtompset
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 19222: Why does dt_from_string not understand yyyy-mm-ddThh:mm:ss?
Bug 19222: Why does dt_from_string not understand yyyy-mm-ddThh:mm:ss?
Bug 19222: Why does dt_from_string not understand yyyy-mm-ddThh:mm:ss?

Description Marcel de Rooy 2017-08-31 12:36:05 UTC
dt_from_string disregards the time part when there is a T before it.
But note that if you print a datetime it actually prints that T.
Like: 2017-08-31T13:32:37

A small regex adjustment could be helpful.
Comment 1 Marcel de Rooy 2017-08-31 12:49:19 UTC
Created attachment 66669 [details] [review]
Bug 19222: Why does dt_from_string not understand yyyy-mm-ddThh:mm:ss?

dt_from_string disregards the time part when there is a T before it.
But note that if you print a datetime it actually prints that T.
Like: 2017-08-31T13:32:37

A small regex adjustment could be helpful.

Test plan:
Run t/DateUtils.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 2 Marcel de Rooy 2017-08-31 13:17:21 UTC
Use case:
I get values like 2017-08-31T13:32:37 from outside xml and want to call dt_from_string on them when importing in a plugin.
Comment 3 Mark Tompsett 2017-09-08 02:39:26 UTC
Created attachment 66968 [details] [review]
Bug 19222: Why does dt_from_string not understand yyyy-mm-ddThh:mm:ss?

dt_from_string disregards the time part when there is a T before it.
But note that if you print a datetime it actually prints that T.
Like: 2017-08-31T13:32:37

A small regex adjustment could be helpful.

Test plan:
Run t/DateUtils.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Comment 4 Mark Tompsett 2017-09-08 02:40:53 UTC
I suppose my pondering over [Z\+-]\d{2}:?\d{2} or something similar for the timezone offset is best saved for another bug, right?
Comment 5 Marcel de Rooy 2017-09-08 05:35:52 UTC
(In reply to M. Tompsett from comment #4)
> I suppose my pondering over [Z\+-]\d{2}:?\d{2} or something similar for the
> timezone offset is best saved for another bug, right?

Thx for signing off. Yeah, open a new report :)
Comment 6 Nick Clemens (kidclamp) 2017-10-26 12:57:05 UTC
Created attachment 68601 [details] [review]
Bug 19222: Why does dt_from_string not understand yyyy-mm-ddThh:mm:ss?

dt_from_string disregards the time part when there is a T before it.
But note that if you print a datetime it actually prints that T.
Like: 2017-08-31T13:32:37

A small regex adjustment could be helpful.

Test plan:
Run t/DateUtils.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 7 Jonathan Druart 2017-10-26 13:46:33 UTC
I discuss this with somebody already, but cannot find the logs.
I do not think we should support this new format, it is the string representation of a DateTime object. If we support it that could lead to hidden bugs.
Comment 8 Marcel de Rooy 2017-10-26 13:56:40 UTC
Some time far away