Skip to content
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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duration.toHuman throws RangeError when Duration uses quarters #1545

Open
luca-audoora opened this issue Nov 27, 2023 · 1 comment
Open

Duration.toHuman throws RangeError when Duration uses quarters #1545

luca-audoora opened this issue Nov 27, 2023 · 1 comment

Comments

@luca-audoora
Copy link

luca-audoora commented Nov 27, 2023

Describe the bug
When using the toHuman() method on any Duration that has the quarters property set, the error RangeError: Invalid unit argument for Intl.NumberFormat() 'quarter' is thrown.

To Reproduce

var luxon = require("luxon")

const dur = luxon.Duration.fromObject({quarters: 1});

console.log(dur.toHuman())

Link to RunKit: https://runkit.com/luca-audoora/luxon-quarters

Actual vs Expected behavior
I expected to get the string "1 quarter" back, above error is thrown instead.

Desktop (please complete the following information):

  • OS: macOS 14.1.1 (23B81)
  • Browser: Firefox 119.0.1 (64-Bit)
  • Luxon version 3.4.3
  • Your timezone "Europe/Berlin"
@dvorakroth
Copy link

Can confirm this bug still happens on Luxon 3.4.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants