Parsing dates with a named day of the week fails.
- Dominant language
- JavaScript
- Stars
- 48.7k
- Forks
- 2.5k
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
Parsing dates with a named day of the week fails. However, switching the function to call `moment` works as expected.
```javascript
const dayjs = require('dayjs')
// Multiple plugins were tested.
let weekday = require('dayjs/plugin/weekday')
let customParseFormat = require('dayjs/plugin/customParseFormat')
let localeData = require('dayjs/plugin/localeData')
let localizedFormat = require('dayjs/plugin/localizedFormat')
let updateLocale = require('dayjs/plugin/updateLocale')
let utc = require('dayjs/plugin/utc')
dayjs.extend(weekday)
dayjs.extend(localeData)
dayjs.extend(customParseFormat)
dayjs.extend(localizedFormat)
dayjs.extend(updateLocale)
dayjs.extend(utc)
// Prints `false`.
console.log(dayjs('Wednesday, December 30th 2020 (6:00 pm)', 'dddd, MMMM Do YYYY (h:mm a)').isValid())
// Prints `true`.
var moment = require('moment');
console.log(moment('Wednesday, December 30th 2020 (6:00 pm)', 'dddd, MMMM Do YYYY (h:mm a)').isValid())
```
**Information**
- Day.js Version 1.9.8
- OS: macOS - Node.js
- Time zone: Pacific
Contributor guide
Research direction
Start by running the supplied Node.js reproduction and compare the Day.js result with Moment's expected parsing behavior. Locate the date-parsing implementation and existing parsing tests, then add coverage for the named weekday and ordinal date format; done means the example returns a valid date without breaking existing formats.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100