Closed alexkmerz closed 4 years ago
whoa, good find @alexkmerz . thank you.
so Pacific/Auckland
does have a DST change in that interval (04/07) - my spider-sense is saying this is the culprit.
Will address this in the next release.
Let me know if you find anything else.
thanks
hey @alexkmerz I think this is fixed now, as of v6.6.0
.
let lastyear = spacetime('2019-01-01', 'Pacific/Auckland')
let pass = spacetime('2020-04-10', 'Pacific/Auckland')
let fail = spacetime('2020-04-17', 'Pacific/Auckland')
console.log('Last year to pass diff: ' + lastyear.diff(pass, 'days'))
console.log('Last year to fail diff: ' + lastyear.diff(fail, 'days'))
// Last year to pass diff: 465
// Last year to fail diff: 472
let me know if you are still seeing anything funny. thank you!
I am currently experiencing an issue where the diff function is off by 1 in certain situations.
The diff in days between 2019-01-01 and 2020-04-10 is showing as 465 days, however, the diff in days between 2019-01-01 and 2020-04-17 is showing as 473 days.
Since the dates are only 7 days apart I would expect the value to return as 472.
Replication code below: