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
dayjs(item).isValid() is not validate item.values #1543
Comments
My guess, is that this is due to the different handling for invalid values. const o = {values: ['2017-06-17']};
moment(o); // Moment<2021-06-21T00:00:00+09:00>
moment(o).format('YYYY-MM-DD'); // 2021-06-21
dayjs(o); // M {
// '$L': 'en',
// '$d': Invalid Date,
// '$x': {},
// '$y': NaN,
// '$M': NaN,
// '$D': NaN,
// '$W': NaN,
// '$H': NaN,
// '$m': NaN,
// '$s': NaN,
// '$ms': NaN
// }
dayjs(o).format('YYYY-MM-DD'); // Invalid Date Please give feedback if my comment it's wrong. |
I am not sure that you aleady understand my point; what i say is |
used An important point is
"moment" and "dayjs" is returned unintentional values. i guess it was means parameter You may not understand the explanation.. because of My English is not good enough. 😢 |
Looking at the documentation of moment object parsing you see that moment requires an object with properties like 'year' or 'month' to parse it to a date. What @imwh0im was trying to explain is that the result from moment is valid, because in the case of an object with invalid properties moment simply takes the current date and that of course is valid (not sure, if this is what you had in mind when checking for In dayjs you have to use the
|
Describe the bug
in moment:
but in dayjs
Expected behavior
I hope that when an Object has property of
values
, you should cover it.like this
Information
The text was updated successfully, but these errors were encountered: