https://en.wikipedia.org/wiki/ISO_8601#Times says that the precision cannot be more than milliseconds, and we got nano instead: https://carc.in/#/r/68k2
"2019-02-13T12:39:21.984607000Z" # Should be 2019-02-13T12:39:21.984Z
Also https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString
_Edit:_
There is no limit on the number of decimal places for the decimal fraction. However, the number of decimal places needs to be agreed to by the communicating parties
However, I'm having troubles with https://realworld.io specs, they require milliseconds precision. Maybe make it possible to specify the precision as an argument?
The ISO specification states The number of digits in the decimal fraction shall be determined by the interchange parties, dependent upon the application. And even the Wikipedia article doesn't mention any limit to milliseconds. On the contrary, it states there is no limit.
If you need a string representation with less precision, you can simply adjust the time value prior to formatting. I don't think there is a need to make this configurable in the formatter.
I would instead open an issue in https://realworld.io and ask them to support any number of digits in the decimal fraction.
Indeed, but different third parties may have different number of decimals. Shouldn't it be better to allow to specify this number upon formatting?
@vladfaust You can use %3N, %6N, etc. You can build the format yourself.
Absolutely. I use "%FT%T.%LZ" in the application. But I'm speaking of possible enhancements of Time::Format::ISO_8601_DATE_TIME.format and Time::Format::ISO_8601_TIME.format methods.
Sorry, but we can't keep doing small changes to accommodate every use case on earth, specially if there's already a way to do what you want.
Most helpful comment
Sorry, but we can't keep doing small changes to accommodate every use case on earth, specially if there's already a way to do what you want.