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

Function as does not support quarter parameter #4886

Closed
alfaslash opened this issue Dec 5, 2018 · 1 comment · Fixed by #4887
Closed

Function as does not support quarter parameter #4886

alfaslash opened this issue Dec 5, 2018 · 1 comment · Fixed by #4887

Comments

@alfaslash
Copy link
Contributor

Description of the Issue and Steps to Reproduce:

Duration#as('x') method throws an error when trying to pass quarters as an argument, although in the docs it's stated that it should work with all the shorthand keys from moment#add

Link to docs: https://momentjs.com/docs/#/durations/as/

Example:

moment.duration(2, 'd').as('Q');

Result (error):

Uncaught Error: Unknown unit quarter
    at Duration.as (global.js:4193)
    at <anonymous>:1:25

Environment:
All platforms and all browsers.


If you are reporting an issue, please run the following code in the environment you are using and include the output:

console.log( (new Date()).toString())   --> "Wed Dec 05 2018 20:46:22 GMT+0500 (Екатеринбург, стандартное время)"
console.log((new Date()).toLocaleString())   --> "05.12.2018, 20:47:24"
console.log( (new Date()).getTimezoneOffset())   --> -300
console.log( navigator.userAgent)   --> "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36"
console.log(moment.version)   --> "2.22.2"
@ichernev
Copy link
Contributor

Close in favor of #4887

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

Successfully merging a pull request may close this issue.

2 participants