react-spectrum
react-spectrum copied to clipboard
Difference between dates in @internationalized/date
Provide a general summary of the feature here
It would be great if it was possible to return the number of years/months/days etc between two dates/datetimes in @internationalized/date. Something like https://moment.github.io/luxon/#/math?id=diffs or https://tc39.es/proposal-temporal/docs/plaindatetime.html#until which can return the difference in a variety of units.
๐ค Expected Behavior?
A method on the date/time instances that can be called to get a difference between it and another date, like
startDate.diff(endDate) // returns { years: 1, months: 1, ... }
๐ฏ Current Behavior
Currently no equivalent feature exists.
๐ Possible Solution
No response
๐ฆ Context
I need to calculate differences between dates to show them in the UI, or change how the UI acts depending on the length of the ranges.
๐ป Examples
No response
๐งข Your Company/Team
No response
๐ท Tracking Issue
No response