Closed Maxim-Mazurok closed 10 months ago
Sorry again for the regression, this one is on me. This case is unfortunately not covered by the current tests, so it was not caught. I was under the impression we had enough tests, so I was confident in my solution. Unfortunately this was not true.
I am investigating this issue at the moment. The problem is, again, with normalize
(which shiftToAll
uses). Here is a simplified reproduction:
const duration = Duration.fromObject({years: 100, months: 0, weeks: -1, days: 0}, { conversionAccuracy: 'longterm' });
console.log(duration.normalize().toObject());
All good, this is why I have tests :) I'm glad they helped to catch these things! I'm in no hurry to upgrade, v3.3.0 seems to work fine for my needs, I've put a note for myself to try updating again when this gets resolved, cheers!
Also wanted to mention that doing bla.shiftToAll().shiftToAll()
produces desired/expected results, maybe that will help
@Maxim-Mazurok Please see the pull request I have created.
Additionally, I have noticed that in your code you are passing the option conversionAccuracy
to the DateTime
factory methods. Those methods do not have such an option, so it has no effect here.
Thank you, the fix works!
Describe the bug What used to be
P99Y11M3W2DT10H29M6S
in v3.3.0 is nowP99Y11M3.3481250000000005W
in v3.4.2To Reproduce
You can run it on https://npm.runkit.com/luxon and see the unexpected
{warrantyLeft: "P99Y11M3.3481250000000005W"}
in the output.Actual vs Expected behavior
You can run it on https://npm.runkit.com/luxon and see the expected
{warrantyLeft: "P99Y11M3W2DT10H29M6S"}
in the output.Desktop (please complete the following information):
Additional context Might be loosely related to https://github.com/moment/luxon/issues/1482 ?