Parsing string to time issue with post meridiem
- Dominant language
- JavaScript
- Stars
- 48.7k
- Forks
- 2.8k
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
Replaced our application from moment to use dayjs and facing issues with our Timepicker.
while parsing this string to time, had to pass the format as array of strings unlike Moment but still we are not getting the expected result.
Plugins used:
import CustomParseFormat from "dayjs/plugin/customParseFormat";
import advancedFormat from "dayjs/plugin/advancedFormat";
**Current Behavior**
dayjs('3p', ['LT', 'h:mm', 'hh', 'h a', 'h']).format('LT'); // result 3.00 AM
dayjs('3:03 PM', ['LT', 'h:mm', 'hh', 'h a', 'h']).format('LT'); // result 3.03 AM
**Expected behavior**
When 3p is passed expected to return 3:00 PM
Match moment api and pass same format.
moment('3p', 'LT').format('LT'); // result 3:00 PM
moment('3:03 pm', 'LT').format('LT'); // 3:03PM
**Information**
- Day.js Version - 1.10.4
- OS: Mac
- Browser - Chrome 90
- Time zone: EST
Contributor guide
Research direction
Start by reproducing the examples with the customParseFormat and advancedFormat plugins, using the reported Day.js version and format arrays. Trace how the parser handles the `p` and `PM` meridiem inputs, then add regression coverage for both cases; done means they format as 3:00 PM and 3:03 PM respectively.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100