sanctuary-js / sanctuary

:see_no_evil: Refuge from unsafe JavaScript

Home Page:https://sanctuary.js.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

behaviour of S.parseDate is unspecified for some inputs

davidchambers opened this issue · comments

MDN:

Note: parsing of date strings with the Date constructor (and Date.parse, they are equivalent) is strongly discouraged due to browser differences and inconsistencies. Support for RFC 2822 format strings is by convention only. Support for ISO 8601 formats differs in that date-only strings (e.g. "1970-01-01") are treated as UTC, not local.

#455 is an example of problems that arise when one relies on implementation-dependent behaviour.

It's possible that S.parseDate could reject strings in formats we know to be handled inconsistently. This may not be practical, in which case we should remove the function from the library. @syaiful6 raised the possibility of creating a dedicated library for parsing date strings in various formats. :)

📆