New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem with intervalToDuration function - undefined is not included in output as 0 #3658
Comments
Hey! Thank you for the report. The docs are indeed outdated. For compactness's sake, 0 values are omitted starting from v3. Is there a specific use case for that? |
We would like to format it to a "time left" string like So to fix this we do something like this right now: return `${hours || 0}h ${minutes || 0}m ${seconds || 0}s` |
@SimonVillage I see, thank you! Yeah, I guess you'll have to go with that. The types also reflect it if that is of any help. I'll make sure to update the docs. Thanks! |
I wonder if we can't add an options parameter with |
@SimonVillage I don't think it's a bad idea, a PR is welcome. If you decide to make it happen, please also add the export type NormalizedDuration = Required<Duration> |
This seems like a very bad move. Function return values should have a definitive shape. Just got bit by it. |
There is an issue with the intervalToDuration function
The problem
馃捇 Code demonstrating the problem
馃檨 Actual behavior
seconds is not included. The documentation however shows an object output with
seconds: 0
馃檪 Expected behavior
seconds should be included in the output with value 0
Debug information
The text was updated successfully, but these errors were encountered: