iamkun / iamkun/dayjs

[BUG] dayjs "YYMMDD" Parsing, Formatting Issue

Open
#2,382 4 comments 1 reaction 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**
```typescript
const startDate = '230701'
const endDate = '230702';

dayjs(startDate, 'YYMMDD').startOf('day').format() // '2307-01-01T00:00:00+09:00'
dayjs(endDate, 'YYMMDD').endOf('day').format() // '2307-02-01T23:59:59+09:00'

dayjs(startDate, 'YYMMDD').startOf('day').format('YYMMDD') // '070101'
dayjs(endDate, 'YYMMDD').endOf('day').format('YYMMDD') // '070201'
```

How Can I solve this problem?

**Expected behavior**
I think it should be
`20230701T00:00:00+09:00`
`20230702T23:59:59+09:00`
`230701`
`230702`
in order from top to bottom

**Information**
- Day.js Version "^1.11.7"
- OS: MacOS
- Browser: X (in express server)
- Time zone: UTC+09:00 KST (Korean Standard Time)

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the YYMMDD parsing and formatting examples from the issue in Day.js. Trace the date parsing and format-token handling used for YY and MMDD, then verify that startOf/endOf produce the expected 2023 dates and that formatting returns 230701 and 230702.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
backend
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.