fix: Twelve Hour parsing issue
This PR closes the Issue #4720
- [X] Fix issue 4720
- [X] Fix 12hour format bug
- [X] Auto capitalize AM/PM in the formatter
- [x] Set placeholder according to user time format
- [ ] Add tests
Feature Preview
PR Checklist
- [x] My code adheres to AppFlowy's Conventions
- [x] I've listed at least one issue that this PR fixes in the description above.
- [ ] I've added a test(s) to validate changes in this PR, or this PR only contains semantic changes.
- [x] All existing tests are passing.
Hi @AnsahMohammad, please add some tests to cover this functionality to avoid running into the same issue as the last PR.
Hey @AnsahMohammad Do you need help adding a test for this?
Hey @AnsahMohammad Do you need help adding a test for this?
Yes, thank you! I've been trying to find the test files related to mention_date_block, but I couldn't find them (I later got busy with university exams). Could you help me find the existing test files so that I can extend them?
@Xazin I also found few additional bugs/ improvements that we can make:
Screencast from 28-02-24 06:11:14 PM IST.webm
- The parser doesn't seem to work properly when input is given as 12:30 AM or 12:30 PM. I suspect this might be due to the time format being "HH:mm a" instead of "hh:mm a" for the 12-hour format.
- Currently, the parser only works correctly if AM/PM is typed strictly in uppercase. Should we modify it to accept AM/PM in either uppercase or lowercase?
- Despite my time format being set to the 12-hour format, the placeholder displays the time in the 24-hour format when I click on the time field. Should this be changed?
- The parser doesn't seem to work properly when input is given as 12:30 AM or 12:30 PM. I suspect this might be due to the time format being "HH:mm a" instead of "hh:mm a" for the 12-hour format.
I would have to look into it to be able to find out the reason why, but you can try to change the format and see if it helps.
- Currently, the parser only works correctly if AM/PM is typed strictly in uppercase. Should we modify it to accept AM/PM in either uppercase or lowercase?
If we add transforming the string to uppercase to the text formatter, wouldn't that solve this particular issue?
- Despite my time format being set to the 12-hour format, the placeholder displays the time in the 24-hour format when I click on the time field. Should this be changed?
Yeah that can be changed, seems like it's something I missed when adding support for User date/time format.