Easy Date Comparison With DayJS
Last updated
Was this helpful?
Last updated
Was this helpful?
Let's say my application fetches dates from the server which come back in string form as "YYYY-MM-DD"
and I'd like to know if those dates already passed. This can be done easily by wrapping dates in and using its comparison functions.
The dayjs()
function can be used to construct DayJS date objects from Date objects and strings. These can then be compared with functions like isBefore()
and isAfter()
.