-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
Current Behaviour
When day and month are too close between each other, e.g.: 2021-01-17 and 2015-02-04, years throws 6 as the year difference instead of 5.9~ish
Expected Behaviour
Using years with these dates: 2021-01-17 and 2015-02-04 should return 5.9~ish instead of 6.
Steps to Reproduce
import DateDiff from 'date-diff';
const diff = new DateDiff( new Date(2021, 01, 17), new Date( 2015, 02, 04 ) );
console.log(diff.years()); // output: 6
Environment 🌎
Windows 10 - WSL 2
node v10.20.1
A workaround is to use months instead of years, and then calculate the years difference from that.
Metadata
Metadata
Assignees
Labels
No labels