-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
toISOString should not be effectful #38
Comments
I took a look at the code and I agree with you. |
Though, from the git blame I see that @garyb wrote this originally. He's usually pretty thoughtful and deliberate. https://github.com/purescript-contrib/purescript-js-date/blame/v8.0.0/src/Data/JSDate.purs#L256-L256 Maybe we should wait to see if he wants to explain this. |
It's because it can throw an exception unfortunately, if the date is invalid. I think that's only when the underlying value is like |
I assumed this library would provide safe abstraction. I see that it passes the invalid values from JS
Would be good to add documentation to the library or to relevant functions that it can return invalid outputs. Bit of a missed opportunity to turns those invalid outputs to |
There are a bunch of effectful methods with in the description
according to the current machine's date/time
. I guess when the machine switches to another timezone or DST the time will be updated.There are other methods that are not effectful with in description
according to UTC
.Description of toISOString https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString
IMO this method should be non-effectful like the other UTC methods
The text was updated successfully, but these errors were encountered: