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
A timestamp created by Python datetime.datetime.today().isoformat() outputs 2017-11-21T08:34:28.150206. When reading this in from file and parsing it with d3.utcParse("%Y-%m-%dT%H:%M:%S.%L"), I get an error since the fractional seconds part has six instead of three digits. Without knowing what the ISO standard really specifies there, it were nice if %L could either be more lenient and accept any number of consecutive digits, or the number of digits could be specified. This would save the effort of having to truncate/reformat the string before parsing it and would allow direct export/import of ISO datetime data.
The text was updated successfully, but these errors were encountered:
You can use %f to parse microseconds, though note that JavaScript dates only have millisecond resolution so this loses information. This feature was added in d3-time-format 2.1.0 (d3 4.12.0).
Also, if you don’t mind relying on relatively recent browsers, you can use d3.isoParse to parse these strings instead (or simply use the Date constructor). You will need to add the trailing Z for UTC.
d3.isoParse("2017-11-21T08:34:28.150206Z")// Tue Nov 21 2017 03:34:28 GMT-0500 (EST)newDate("2017-11-21T08:34:28.150206Z")// Tue Nov 21 2017 03:34:28 GMT-0500 (EST)
A timestamp created by Python datetime.datetime.today().isoformat() outputs 2017-11-21T08:34:28.150206. When reading this in from file and parsing it with d3.utcParse("%Y-%m-%dT%H:%M:%S.%L"), I get an error since the fractional seconds part has six instead of three digits. Without knowing what the ISO standard really specifies there, it were nice if %L could either be more lenient and accept any number of consecutive digits, or the number of digits could be specified. This would save the effort of having to truncate/reformat the string before parsing it and would allow direct export/import of ISO datetime data.
The text was updated successfully, but these errors were encountered: