-
-
Notifications
You must be signed in to change notification settings - Fork 121
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
DateRangeFilter crashes if the current locale isn't supported #346
Comments
- fixes #346 - when using a locale that Flatpickr doesn't support, like "ua", it should use "en" (English) as default locale. - it will display a console warning that this locale is not supported but not throw an error (unless user set a different locale, see next) - user can choose to override the locale by setting locale to use via `filterOptions: { locale: 'en' }`
That is a valid bug, I created a PR #347 to address wath you wrote. However please note that I will show a console warning (see the print screen in the PR) to advise user that it's not a supported locale in Flatpickr, I could have use English straight away without any console warnings, but I think it's better to advise the user (you) that it's not a valid Flatpickr locale and so you know where the error originated. If you read the warning, I mentioned that you can avoid seeing the console warning by overriding the locale via the BTW, there's 2 console warnings in the Filter by Range Example since there are 2 different Date Filters (which both had to be fixed, those are the See the PR #347 for more info and if you could confirm that this is the behavior you wanted, I'll merge it right after. Thanks for reporting and suggesting fixes. |
I'll merge the PR and go with that since I didn't feedback from your side and I need to fix another bug and do another release soon. |
Released under version 2.14.3 Also if you haven't already, please upvote ⭐️ |
I'm submitting a Bug report
Your Environment
Context
My current locale is
ua
. I want to create a column with a date range filter. Flatpickr doesn't supportua
locale out of the box, so I tried explicitly specifying a supported locale:Expected Behavior
A date range filter that uses English locale
Current Behavior
(sorry, this doesn't show typescript line numbers)
Possible Solution
Here is the relevant part of DateRangeFilter.buildDatePickerInput:
I think
loadFlatpickrLocale
should returnen
if it can't load the locale, instead of throwing an exception. Alternatively you can avoid callingthis.loadFlatpickrLocale(currentLocale)
ifpickerOptions.locale
exists.Code Sample
The text was updated successfully, but these errors were encountered: