Open wb459 opened 3 months ago
For some reason, I'm also getting a very strange result:
console.log(
Duration.fromObject({ days: 365 * 2 }) // 2 years
.shiftToAll()
.toHuman(), // toObject does return the same results
); // output - 2 years, 2 months, 0 weeks, 2 days, 0 hours, 0 minutes, 0 seconds, 0 milliseconds
I have no idea where another two months and two days came from.
Describe the bug Duration::shiftTo does not convert to years correctly. A value in milliseconds less than 1 year results in a new duration that is longer than a year.
To Reproduce
Actual vs Expected behavior Actual: {years: 1, months: 0, days: 4, hours: 23, minutes: 59, seconds: 0, milliseconds: 0}
Expected: According to https://github.com/moment/luxon/blob/master/docs/math.md a year is considered to be 365 days or 31536000000 milliseconds (365 24 60 60 1000).
Desktop: