Duration normalize is buggy
See original GitHub issueDuration.fromObject({ minutes: 120 }).normalize().toObject();
// => { minutes: 120 }
Does not change anything, however when I put in hours: 0
then I get
Duration.fromObject({ hours: 0, minutes: 120 }).normalize().toObject();
// => { hours: 2, minutes: 0 };
Looking at this function from the luxon code seems to reveal the issue
function normalizeValues(matrix, vals) {
reverseUnits.reduce(function (previous, current) {
if (!isUndefined(vals[current])) {
if (previous) {
convert(matrix, vals, previous, vals, current);
}
return current;
} else {
return previous;
}
}, null);
}
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Whitespace is hard and buggy. Can we normalize it? - WICG
Whitespace is a difficult topic for many reasons, not least of which is that it's hard to see what others are talking about...
Read more >How to doubly normalize scientific data by baseline time point ...
I would like to first take each well and normalize (as in, divide) all the parameters by the median parameters at baseline (all...
Read more >Normalize Buggy? | Studio One Forum ... - PreSonus Forums
For the life of me, when I use the normalize function in StudioOne it brings the volume of my files DOWN every time....
Read more >Variant Normalization - Genome Analysis Wiki
It is a property describing the nature of the length of a variant's alleles and is defined as follows: A variant is parsimonious...
Read more >Normalize plugin buggy behavior. PT 10
Normalize plugin buggy behavior. ... slightly...if I keep hitting Render, it will incrementally go up - maybe a dB or two each time....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’m not sure about the analogy, but yes, Luxon’s durations are just like that. It seemed too confusing for Luxon to add new keys without you telling it to (e.g. via
shiftTo
). You can of course add all the keys and later filter out the zeros.@atruskie that’s a different problem. I think you mean
example.as("years")
.get
is just a getter for the unit