You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the only way to create a datetime is to use now() or the datetime constructor with individual components explicitly provided. However, that is essentially never useful for ingesting external inputs, meaning that for any data coming in from JSON, YAML, etc., the user has to hack in a string parser themselves to be able to use time manipulation functions in any capacity. That's a big drawback for things like invoice templates.
There should be a way to parse a datetime-containing string into a datetime that's built-in. There was a previous PR in #1668 which aimed to implement parsing Unix timestamps, but it got closed in favour of a generalised implementation that could parse more formats. It doesn't seem that that implementation ever materialised, nor does there seem to be an existing discussion of it. I'm opening this issue to hopefully revive the topic.
Use Case
Any situation in which external data are ingested and contain dates that need to be manipulated. For example:
Generating invoices with due dates automatically calculated, based on the contents of a JSON file
Displaying a date value in a different format than the one given (i.e. "2024-07-01" → "1 July 2024")
Extracting a date to be displayed out of a a full timestamp given as a string
Generating a calendar for a given month, based on a value passed in through sys.inputs
The text was updated successfully, but these errors were encountered:
I don't believe YAML supports timestamps as much as it allows applications to recognise certain values and convert them to timestamps automatically. Either way, that does nothing for other formats such as JSON or sys.inputs, so the need for a parser is still there.
Description
Currently, the only way to create a datetime is to use
now()
or thedatetime
constructor with individual components explicitly provided. However, that is essentially never useful for ingesting external inputs, meaning that for any data coming in from JSON, YAML, etc., the user has to hack in a string parser themselves to be able to use time manipulation functions in any capacity. That's a big drawback for things like invoice templates.There should be a way to parse a datetime-containing string into a
datetime
that's built-in. There was a previous PR in #1668 which aimed to implement parsing Unix timestamps, but it got closed in favour of a generalised implementation that could parse more formats. It doesn't seem that that implementation ever materialised, nor does there seem to be an existing discussion of it. I'm opening this issue to hopefully revive the topic.Use Case
Any situation in which external data are ingested and contain dates that need to be manipulated. For example:
sys.inputs
The text was updated successfully, but these errors were encountered: