Closed
Description
openedon Apr 25, 2019
An instance of DateTimeFormat
can do Date -> string
but cannot do the reverse string -> Date
for formatted strings it created.
It's very hard to implement that in user-land because different browsers might handle different languages in different ways?
My proposal is a parse
method that is reverse of the format
method:
const x = new Intl.DateTimeFormat(/* format options */);
// true, assuming format options are lossless
x.parse(x.format(aDate)).getTime() === aDate.getTime()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment