Replies: 2 comments 7 replies
-
I have looked into this and agree that it is buggy behavior. I think we should patch this, but maybe that would be breaking for some people, so I'll leave that decision to leadership. I can't imagine how this behavior would be useful to anyone as-is. It is not that pretty, but for practical purposes, you can suppress the negative sign using Intl.NumberFormat options, namely
|
Beta Was this translation helpful? Give feedback.
-
This is not necessarily desired for all durations. For example, Duration.fromObject({hours: -1.5}).toFormat('hh:mm'); // -01:-30 as before
Duration.fromObject({hours: -1.5}).toFormat('hh:mm', { leadingSignOnly: true }); // -01:30 What do you think? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I am trying to format a negative duration using Luxon. Specifically, I have a duration of -1.5 hours, and I would like to display it as -01:30. However, when I use the following code:
I get the output -01:-30 instead of the desired -01:30.
Could someone please help me understand how to correctly format a negative duration in this case (assuming this is possible)?
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions