dayjs fromNow returns Invalid Date
Describe the bug dayjs(NaN).fromNow(false);
returns "a month ago"
Till release 1.11.8 it was always returning "NaN years ago"
Information
Day.js Version 1.11.9 Time zone: GMT+02:00 [MESZ]
https://runkit.com/embed/iol116brss5g
When will this issue be solved?
Same for undefined value.
dayjs(undefined).fromNow()
// result: 'a month ago'
This is wrong, but the question is, how to handle that. NaN creates a dayjs instance with NaN values inside. But undefined creates a dayjs object like dayjs() with no params. Which should result in 'a few seconds ago' and not a month ago. But dayjs().fromNow() seems to work.
But in any case the developer should check the value before passing it to dayjs. But dayjs fromNow could also handle this in all other ways than retuning wrong text. For example "Invalid date" or "Unknown" or just an empty string?