You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My first issue was that Date.parse("10 mars 2023") resolved to a date in May (current month).
It turns out that the original expression for Tuesday (Mardi in French) matched because it was :"^ma(r(.(di)?)?)?" ; The '.' actually matches any character and therefore "mars" was matched as the day of the week. However, an issue also arises when matching 'mai' in the month of june. This was fixed by adding an end of word condition.
When I tested Date.parse("vendredi next week"), this failed because the regex for en-US did not have the leading ^, while the french version had /^fr(i(day)?)?/":"^ve(n(\\.|dredi)?)?", as for the other dates. So I updated the en-US regex for that.
It's possible thought that the day of the week expression would need to have the leading "^" removed to make Date.parse("next vendredi") work.
There is a test case for that - maybe it passed by chance.
Also and expression like "^ma(r(.(di)?)?)?" is invalid as it does not match "mardi" which is the normal name for the day in the week, it has to be "^ma(r(\.|di)?)?", so that "ma", "mar", "mar." or "mardi" work. But that could stil partially match mai which is another valid date field value. So we need "^ma(r.|(r(di)?)?\b)" which matches 'ma' only when it's a word.
Applying this on the fr-FR culture file gives the following working options.
I also added accent free versions. "aout" is the official preference over "août" and a lot of french people type without the accents to speed up typing.
If somebody makes a fork with these changes, please leave a comment here.
The text was updated successfully, but these errors were encountered:
mdeweerd
changed the title
Bad regex expressions - "." not escaped, "/fr(i(day)?)?/" instead of "/^fr(i(day)?)?/"
Bad regex expressions - "." not escaped, "/fr(i(day)?)?/" instead of "/^fr(i(day)?)?/" and more
May 29, 2023
Related to #241, #249 and possibly others.
My first issue was that Date.parse("10 mars 2023") resolved to a date in May (current month).
It turns out that the original expression for Tuesday (Mardi in French) matched because it was :"^ma(r(.(di)?)?)?" ; The '.' actually matches any character and therefore "mars" was matched as the day of the week. However, an issue also arises when matching 'mai' in the month of june. This was fixed by adding an end of word condition.
When I tested
Date.parse("vendredi next week")
, this failed because the regex for en-US did not have the leading^
, while the french version had/^fr(i(day)?)?/":"^ve(n(\\.|dredi)?)?",
as for the other dates. So I updated the en-US regex for that.It's possible thought that the day of the week expression would need to have the leading "^" removed to make
Date.parse("next vendredi")
work.There is a test case for that - maybe it passed by chance.
Also and expression like "^ma(r(.(di)?)?)?" is invalid as it does not match "mardi" which is the normal name for the day in the week, it has to be "^ma(r(\.|di)?)?", so that "ma", "mar", "mar." or "mardi" work. But that could stil partially match mai which is another valid date field value. So we need "^ma(r.|(r(di)?)?\b)" which matches 'ma' only when it's a word.
Applying this on the fr-FR culture file gives the following working options.
I also added accent free versions. "aout" is the official preference over "août" and a lot of french people type without the accents to speed up typing.
and in the Default CultureInfo:
If somebody makes a fork with these changes, please leave a comment here.
The text was updated successfully, but these errors were encountered: