iamkun / iamkun/dayjs

dayjs("25-AUG-2023", "DD-MMM-YYYY") give invalid date error

Open
#2,430 2 comments 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

I am in the process of migrating from moment.js to day.js. While the format dayjs("25-AUG-2023", "DD-MMM-YYYY") results in an "invalid date" error with day.js, it works perfectly with moment.js. I've found that changing it to dayjs("25-Aug-2023", "DD-MMM-YYYY") works, but we have numerous dates with uppercase months. Is there a way to make the "MMM" format less restrictive in day.js?

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the two examples from the issue and inspect Day.js handling of the MMM token during parsing. Compare uppercase and title-case month inputs, then verify that uppercase month names are accepted without breaking existing date parsing behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api
Issue type
Bug
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.