iamkun / iamkun/dayjs

Valid date with UTC offset fails validaton

Open
#2,730 1 comment 11 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**

1. Using the following date as an example:
`var input = "09/04/2024 21:12:50 +00:00";`
2. Strictly validate the input:
`var isValidDayJsDate = dayjs(input, "MM/DD/YYYY HH:mm:ss Z", true).isValid();`
3. BUG: Validation fails.

**Expected behavior**

Compliant date should pass validation.

**Information**
- Day.js Version 1.11.11
- OS: Windows 11 Pro
- Browser chrome 128
- Time zone: [e.g. GMT-07:00 DST (Pacific Daylight Time)]

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the strict parsing call with the supplied date, format, and Day.js version, then trace the custom-format parsing path that handles the UTC offset token. Done means the compliant input returns true from isValid() without breaking other strict date validations.

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.