-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Encoder tests expect submillisecond precision #155
Comments
Not entirely sure what the best solution is; these tests are examples from the spec, and I'd like to keep all of them. I'm not sure if it's worth adding a flag for this; not many implementations support only ms precision. Why not support ns precision in your JS parser? Not a JS expert, but doesn't the Date type support that? |
JS' Date object encapsulate an integral number that represents milliseconds since the midnight at the beginning of January 1, 1970, UTC (the epoch). (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date). I could use a custom object that adds submillisecond precision, but that'd be a custom extension to the I understand these are examples from the spec, but the spec also mentions quite clearly only millisecond precision is required, and that additional precision is implementation-specific; as such I'd assume a parser that only outputs millisecond-precision would pass tests, at least the "default ones". Maybe an "extended spec support" flag could be added that'd test for submillisecond precision, but they should be opt-in IMHO. |
Right, thanks. I'd prefer to have the common case be the default, which is support for 64bit ints and datetime ns precision. AFAIK JavaScript is the only mainstream language that doesn't support that well natively. Not sure what the best approach is; also need to consider that many people don't use the |
I have a bunch of tests fail for my toml encoder due to tests expecting my encoder to output time with submillisecond precision.
The text was updated successfully, but these errors were encountered: