iamkun / iamkun/dayjs

When using dayCustomParseFormat time zone offset other than current locale (+03:00) is not valid

Open
#2,862 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**
when using the plugin: customParseFormat
offsets in the dateTimeString fails on validation when the time zone is different from exist one, meaning:
if I am at GMT+3 all date time strings will fail if the time zone offset is different from +03:00

**Expected behavior**
testParsing("2025-04-20T08:08:50+06:00");
testParsing("2025-04-20T12:08:50+03:00");
testParsing("2025-04-20T12:08:50-05:00");
testParsing("2025-04-20T12:08:50+00:00");

should be valid, but only this one is valid: testParsing("2025-04-20T12:08:50+03:00");

**Information**
- Day.js Version 1.11.13
- OS: Mac
- Browser chrome 135.0.7049.85
- Time zone: GMT+3

code example:
https://codesandbox.io/p/sandbox/gifted-tharp-4n4lhp?file=%2Fsrc%2FApp.js%3A19%2C26

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the four date-time examples from the issue or linked CodeSandbox with Day.js 1.11.13, then inspect the customParseFormat plugin's offset validation path. Done means offsets +06:00, +03:00, -05:00, and +00:00 are all accepted regardless of the local GMT+3 timezone.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.