You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is such a basic piece of functionality and it makes this package unusable in cases where input must be validated. So what is the thinking here and why has date.js been created in a way that faulty input like this:
date("blah")
actually returns a valid date?
In use cases where an end user is trying to run a search for a time/date range it isn't desired to have every failed parsing default to now/today.
So why is it built this way and why is there no configuration option to turn that off? If a bad date string is provided I wouldn't personally want any value returned.
It's very easy for consumers of date.js to do this if they always want a date value:
function parseDate(val) {
return date(val) || date("now")
}
But there isn't a way for us to ensure that invalid date values are rejected.