d3 / d3-dsv

A parser and formatter for delimiter-separated values, such as CSV and TSV.
https://d3js.org/d3-dsv
ISC License
437 stars 76 forks source link

Use RFC3339 date string format in fixtz Date constructor #63

Closed hkasemir closed 4 years ago

hkasemir commented 4 years ago

After the latest version bump to D3@5.14.1, some of my tests started to fail with the following error from timezone-mock, which I use to mock UTC for my tests.

AssertionError [ERR_ASSERTION]: Unhandled date format passed to MockDate constructor: 2019-01-01T00:00

https://github.com/Jimbly/timezone-mock/blob/ffe306c2/index.js#L33

Turns out "2019-01-01T00:00" is not an RFC3339 format. This PR adds the seconds precision to this date string so it matches spec.

mbostock commented 4 years ago

The format specification is defined by the ECMAScript language specification:

https://www.ecma-international.org/ecma-262/#sec-date-time-string-format

To quote the specification:

It also includes “date-time” forms that consist of one of the above date-only forms immediately followed by one of the following time forms with an optional time zone offset appended:

THH:mm THH:mm:ss THH:mm:ss.sss

hkasemir commented 4 years ago

Fair enough, ECMAScript spec overrides. Closing.

Thanks for the review!