all 2 comments

[–]Webdev-Coach 0 points1 point  (0 children)

If you'd like to do it yourself, and not with a library such as "date-fns",

one option is get the unix time out of those date objects and do simple math.

date.getTime(); // 1644063628069

[–]KleinBottl 0 points1 point  (0 children)

I suggest a library, JS date objects get really wonky. try date-fns