iamkun / iamkun/dayjs

utcOffset(X, true) manipulates caller instance

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

Description

**Describe the bug**
https://github.com/iamkun/dayjs/blob/7151139f047a71c39cf63608c6aeb4f6876c8078/src/plugin/utc/index.js#L92
`utcOffset(X, true)` method does not clone before setting $offset, so caller dayjs object will be manipulated.

**Expected behavior**
`utcOffset(X, true)` should not manipulate the original instance.

**Information**
- Day.js Version 1.11.3

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.