Bug 19222 - Why does dt_from_string not understand yyyy-mm-ddThh:mm:ss ?
Summary: Why does dt_from_string not understand yyyy-mm-ddThh:mm:ss ?
Status: RESOLVED LATER
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Marcel de Rooy
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-08-31 12:36 UTC by Marcel de Rooy
Modified: 2017-10-26 13:56 UTC (History)
2 users (show)

See Also:
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? (2.11 KB, patch)
2017-08-31 12:49 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 19222: Why does dt_from_string not understand yyyy-mm-ddThh:mm:ss? (2.13 KB, patch)
2017-09-08 02:39 UTC, Mark Tompsett
Details | Diff | Splinter Review
Bug 19222: Why does dt_from_string not understand yyyy-mm-ddThh:mm:ss? (2.18 KB, patch)
2017-10-26 12:57 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
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