fix(quick add magic): time parsing for certain conditions #2367

Merged
konrad merged 1 commits from fix/quick-add-magic-time into main 2022-09-15 11:59:30 +00:00
Owner

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:

  • Something in 5 days at 10:00
  • Something 17th at 10:00
  • Something sep 17th at 10:00
  • Something at 10:00 in 5 days
  • something at 10:00 17th
  • something at 10:00 sep 17

Resolves #2349

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: * Something in 5 days at 10:00 * Something 17th at 10:00 * Something sep 17th at 10:00 * Something at 10:00 in 5 days * something at 10:00 17th * something at 10:00 sep 17 Resolves #2349
konrad added 1 commit 2022-09-15 09:52:20 +00:00
continuous-integration/drone/pr Build is passing Details
ea92f830fb
fix(quick add magic): time parsing for certain conditions
Resolves #2349
konrad requested review from dpschen 2022-09-15 09:52:25 +00:00
Member

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!

Beep boop, I'm a bot.

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! > Beep boop, I'm a bot.
dpschen reviewed 2022-09-15 11:55:13 +00:00
@ -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

When reading this I realised that this could be internationalized quite easy with the help of Intl.DateTimeFormat: https://stackoverflow.com/a/66627442/15522256
Author
Owner

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.

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/
dpschen marked this conversation as resolved
dpschen approved these changes 2022-09-15 11:55:19 +00:00
konrad merged commit b24d5f2dce into main 2022-09-15 11:59:30 +00:00
konrad deleted branch fix/quick-add-magic-time 2022-09-15 11:59:30 +00:00
This repo is archived. You cannot comment on pull requests.
No description provided.