Manipulating days with decimal numbers ignores hours
See original GitHub issueDescribe the bug
When manipulating a date with unit type day and an arbitrary decimal number does not manipulate the time of the date.
Expected behavior The time is manipulated as well.
Information Stackblitz reproduction: https://stackblitz.com/edit/js-akaprq?file=index.js
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Is it a way to .add() or .subtract() float values? #2430 - GitHub
You can use decimals when adding or subtracting hours, minutes, seconds, or milliseconds, but you can't subdivide days or larger components.
Read more >Alternate Notation, Part 1: Converting Hours to Days-Hours
Learn how to convert hours to days-hours using string manipulation functions in Excel. ... INT turns a decimal number into the closest full...
Read more >Too many decimal places when using timedelta - Stack Overflow
This method does ignore the .days attribute. If you have timedeltas with more than 24 hours, use: def custom_format(td): minutes, ...
Read more >How to Subtract Dates and Times in Excel
Here, the numbers after the decimal represent time, while the number before the decimal represents days. Excel will subtract 1 day and (0.25...
Read more >Convert Time to Decimal Number in Excel (Hours, Minutes ...
In case you only want the complete/full hour value and ignore the minutes part, use the below formula using INT. =INT(A2*24). Use INT...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

It’s not a bug in moment.js, see explanation here: https://github.com/moment/moment/issues/2430#issuecomment-113832948.
Of course you are right. IMO one of the basic definitions for dayjs is that it behaves just like moment (ok, there are a few exceptions 😃. In this regard this is at least another difference.
But as this would be a breaking change (if not of the documentation that says nothing about it, so at least regarding the functionality), perhaps this should become an action point for dayjs 2.0.
@iamkun is there a place, where those requirements for dayjs 2.0 could be documented?
PS: @Bykiev you are pretty fast responding to issues 🥇 👍 😄