Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

months_abbr and days_abbr not used in check_date, does not cope with full stops (i.e. dutch abbreviations) #161

Closed
nathangreaves opened this issue Oct 14, 2020 · 6 comments

Comments

@nathangreaves
Copy link

nathangreaves commented Oct 14, 2020

When using a browser with culture 'nl' (dutch) and a format that contains either 'M' (abbreviated day) or 'D' (abbreviated month), there are 2 issues that exist within the check_date function (which is used to parse a date string against the specified date format, for example when calling the set_date function).
This is causing issues when programatically setting the date, or when passing dates into the 'direction' parameter to specify start date/end date of the datepicker.

The first issue is that in the dutch locale, abbreviated months are represented with a full stop. (i.e. ma. mrt. 11, 2030 which would in the UK be Mon Mar 11 2030). The regex used for 'M' in check_date is [a-z]{3} which therefore does not match this correctly.
The second issue is that if you have specified months_abbr (i.e. in dutch the full month 'March' is 'maart' but the abbreviation is 'mrt.') the code in check_date does not use the abbreviations specified in months_abbr and instead takes the first three characters of months, which as you can see will not work in Dutch.
The same 2 issues exist for days/days_abbr when the format specifier 'D' is used.

I have created a jsfiddle to demonstrate the issue for multiple different languages:
https://jsfiddle.net/wn67e0vh/4/

@stefangabos
Copy link
Owner

i am working now on a fix and will get back to you later today.
thanks for reporting the issue!

@nathangreaves
Copy link
Author

Ah, I also have a fix available and was about to link a pull request! I can step off though if you are on it

@stefangabos
Copy link
Owner

I've done some changes, please have a look and let me know if it works as expected

@stefangabos stefangabos reopened this Oct 14, 2020
@nathangreaves
Copy link
Author

Works great, thanks!

@nathangreaves
Copy link
Author

@stefangabos Please could I request a release with the included changes so that I can update via npm?

@stefangabos
Copy link
Owner

done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants