utc plugin requires specification of parsing format
- Dominant language
- JavaScript
- Stars
- 48.7k
- Forks
- 2.5k
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
When parsing a string with utc plugin, it behaves differently depending on the format of the input date "YYYY-MM-DD" vs "MM/DD/YYYY", when the format is not provided. Once the format of the input string is provided. the plugin starts to behave correctly.
``` ts
console.log(dayjs.utc('2020-01-01').toISOString());
console.log(dayjs.utc('01/01/2020').toISOString());
console.log(dayjs.utc('01/01/2020', 'MM/DD/YYYY').toISOString());
```
Ouput:

**Expected behavior**
The behavior shouldn't depend on the input data format. The output should be the in all three cases, i.e. "2020-01-01T00:00:00.000Z" with no time in it.
**Information**
- Day.js Version: 1.11.10
- OS: Windows 11
- Browser: Edge Version 122.0.2365.52
- Time zone: GMT-0500 (Colombia Standard Time)
Contributor guide
Research direction
Start at the utc plugin and the dayjs.utc entry point, reproducing the three parsing examples from the issue. Trace how inputs without an explicit format are parsed and compare their ISO output with the expected UTC midnight value. Done means all three examples produce the same expected output, with regression coverage added in the relevant test area.
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
- 45/100