iamkun / iamkun/dayjs

daysInMonth() returns 1 when timezone is Asia/Kuala_Lumpur

Open
#3,003 0 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

**Describe the bug**
dayjs('1981-12-01').daysInMonth() returns 1 when browser's timezone is set to either:
- Asia/Kuala_Lumpur
- Asia/Singapore

On January 1, 1982, both Malaysia (where Kuala Lumpur is the capital city) and Singapore adjusted their time zones forward by 30 minutes, moving from UTC+07:30 to UTC+08:00. daysInMonth() could not handle this change of time offset and returns incorrect result.

**Expected behavior**
dayjs('1981-12-01').daysInMonth() should return 31.

**Information**
- Day.js Version v1.10.6
- OS: Windows
- Browser: Chrome, Firefox
- Time zone: Asia/Kuala_Lumpur and Asia/Singapore (UTC+8:00)

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.