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
Hello, thanks for this great resource. I'm working on a new version of my date picker and I'm looking to remove momentjs. I was able to use some of the info here to whittle down the functions I needed. You are welcome to look at the full example on stackblitz as make use of what's there.
One thing I noticed is that your IsSame example with a granularity is not equivalent: new Date(2010, 9, 20).toDateString().substring(4, 7) === new Date(2010, 9, 21).toDateString().substring(4, 7);
While technically does verify that both dates are in Oct this is not what moment/dayjs do. Those libs use their startOf function to take the dates to the beginning of the unit passed and then compare the valueOf. (I think the comparison of dates example should use valueOf as that's a more accurate comparison anyway).
In the provide example moment and dayjs would do the following
Hello, thanks for this great resource. I'm working on a new version of my date picker and I'm looking to remove momentjs. I was able to use some of the info here to whittle down the functions I needed. You are welcome to look at the full example on stackblitz as make use of what's there.
One thing I noticed is that your
IsSame
example with a granularity is not equivalent:new Date(2010, 9, 20).toDateString().substring(4, 7) === new Date(2010, 9, 21).toDateString().substring(4, 7);
While technically does verify that both dates are in
Oct
this is not what moment/dayjs do. Those libs use theirstartOf
function to take the dates to the beginning of the unit passed and then compare thevalueOf
. (I think the comparison of dates example should usevalueOf
as that's a more accurate comparison anyway).In the provide example moment and dayjs would do the following
The text was updated successfully, but these errors were encountered: