-
Notifications
You must be signed in to change notification settings - Fork 745
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.fromObject({ hours: 2 }).milliseconds is 0 #1626
Comments
What do you expect This is documented extensively: https://moment.github.io/luxon/#/math?id=duration-math. The reason |
@diesieben07 /**
* Get the years.
*/
get years(): IfValid<number, typeof NaN, IsValid>;
/**
* Get the quarters.
*/
get quarters(): IfValid<number, typeof NaN, IsValid>;
/**
* Get the months.
*/
get months(): IfValid<number, typeof NaN, IsValid>;
/**
* Get the weeks
*/
get weeks(): IfValid<number, typeof NaN, IsValid>;
/**
* Get the days.
*/
get days(): IfValid<number, typeof NaN, IsValid>;
/**
* Get the hours.
*/
get hours(): IfValid<number, typeof NaN, IsValid>;
/**
* Get the minutes.
*/
get minutes(): IfValid<number, typeof NaN, IsValid>;
/**
* Get the seconds.
*/
get seconds(): IfValid<number, typeof NaN, IsValid>;
/**
* Get the milliseconds.
*/
get milliseconds(): IfValid<number, typeof NaN, IsValid>; in the code, or just that documentation link you posted. Unless I'm the only one who stumbled upon that, then you can ignore my suggestion. |
The |
@diesieben07 |
Describe the bug
Duration.fromObject({ hours: 2 }).milliseconds === 0
Why does it not behave like
To Reproduce
Actual vs Expected behavior
Durations created by factories should behave the same way as diff Durations
OR
this needs to be documented!!!
Desktop (please complete the following information):
Additional context
IMO, the convenience accessors like
get milliseconds(): IfValid<number, typeof NaN, IsValid>;
are not fit for the Duration interface. It makes sense, forDateTime
to get:but not for the Duration interface.
The text was updated successfully, but these errors were encountered: