githubocto / flat-ui

MIT License
373 stars 23 forks source link

Return null date[time]s if unparseable #15

Closed colmanhumphrey closed 3 years ago

colmanhumphrey commented 3 years ago

Fixes #14

Previously, if all the patterns failed, the default was to return the result of parseISO. But that could also fail to parse, returning "Invalid Date".

So now this also checks if that final value is valid, and if not, returns null.

Question: should it be null, or undefined, or doesn't matter?

Other stuff (minor):

Happy to do any other edits here too, e.g. let me know about version numbers etc

Wattenberger commented 3 years ago

this is great, thanks @ColmanHumphrey!