iamkun / iamkun/dayjs

(feat) Date set time from another date.

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

Description

**Feature Description**
It would be great if there is a method to set the time from another date.

```ts
dayjs('2021-03-01T12:34:56.123Z').setTimeFrom(
dayjs('2021-02-28T10:05:12.870Z')
);

// Result: '2021-03-01T10:05:12.870Z'
```

I know there are alternatives and I could write my own method. This is just a suggestion.
Use case: Merge two dates which comes from separat inputs date and time.

day.js `1.10.4`

Contributor guide

Open the contributing guide

Research direction

No file, test, or entry point is named. Start by locating Day.js's existing date-manipulation APIs and related tests, then compare their behavior with the example in the issue. Done means a date can take the time components from another date while preserving its own date components, with tests covering the shown result.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
backend-api-design
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.