formkit / tempo

📆 Parse, format, manipulate, and internationalize dates and times in JavaScript and TypeScript.
https://tempo.formkit.com
MIT License
2.37k stars 33 forks source link

Feature Request: Difference between datetimes #40

Closed shayant98 closed 7 months ago

shayant98 commented 8 months ago

Hi I really like this new library, but for me to migrate to it I really need the functionality of manipulating dates.

Given two Dates: D1 = 2010-06-09T15:32:00Z D2 = 2010-06-09T11:32:00Z

It should return 4 hours (or eq. in days/min/sec)

justin-schroeder commented 8 months ago

Date objects already have this capability as they are cast to milliseconds when combined with logical operators:

const diff = D1-D2

Perhaps there is other functionality you are looking for like formatting relative time? You can follow #7 to track that feature request.