fix(quick add magic): time parsing for certain conditions #2367
No reviewers
Labels
No Label
area/internal-code
changes requested
confirmed
dependencies
duplicate
good first issue
help wanted
hosting
invalid
kind/bug
kind/feature
question
wontfix
No Milestone
No project
No Assignees
3 Participants
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: vikunja/frontend#2367
Loading…
Reference in New Issue
No description provided.
Delete Branch "fix/quick-add-magic-time"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This PR ensures times are always recognized correctly when combined with a date. It also fixes reversing the time and date order.
Example cases which now work but didn't:
Resolves #2349
Hi konrad!
Thank you for creating a PR!
I've deployed the changes of this PR on a preview environment under this URL: https://2367-fix-quick-add-magic-time--vikunja-frontend-preview.netlify.app
You can use this url to view the changes live and test them out.
You will need to manually connect this to an api running somehwere. The easiest to use is https://try.vikunja.io/.
Have a nice day!
@ -13,3 +13,3 @@
}
export const parseDate = (text: string): dateParseResult => {
const monthsRegexGroup = '(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)'
When reading this I realised that this could be internationalized quite easy with the help of Intl.DateTimeFormat: https://stackoverflow.com/a/66627442/15522256
Nice catch. I bet it would have issues in Safari :D
For internationalization of the whole thing I think we'll have to translate the regexes one by one. Not sure yet how / if that's a good way but that's a problem for another day.
Yeah I guess that the Regexes will blow up :D
Most stuff seems to be supported since Safari 14.1 though judging by https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat#browser_compatibility and https://www.stetic.com/de/market-share/browser/