iamkun / iamkun/dayjs

[Question] How to get the difference between two dates as "N year, N months, N days"?

Open
#1,100 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
48.7k
Forks
2.5k
PR merge metrics
No merged PRs in 30d

Description

Hello.
I have a function to get the period, but the problem is only days in a month.
[**Example**](https://codesandbox.io/s/unruffled-elion-dx82k?fontsize=14&hidenavigation=1&theme=dark)

The documentation briefly describes diff, and as I understand it, you can't return the duration, only in a specific unit format
https://day.js.org/docs/en/display/difference

I want to get duration in the context of dates in which this period is specified.

Duration plugin, works without context, it doesn't fit
[**See issue**](https://github.com/iamkun/dayjs/issues/1063#issuecomment-696467960)

Who can help with this issue? Thx

Contributor guide

Open the contributing guide

Research direction

Start by reading the difference documentation and reproducing the behavior in the linked CodeSandbox. Review the referenced issue 1063 discussion for existing context; no repository file or test is identified, so the expected API and completion criteria need clarification before implementation.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
15/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.