Validating date using a locale
See original GitHub issueHi!
Is there a way to validated a date using a locale? Something like dayjs('15/10/2018', {locale: 'pt-br'}).isValid()
?
Thank you!
Issue Analytics
- State:
- Created 5 years ago
- Comments:14 (8 by maintainers)
Top Results From Across the Web
validate a date on the basis of locale argument (intl api)
The "locale" is actually a language code, which is an unreliable way to determine the order in which date components are typically presented....
Read more >Localizing date and time validation - IBM
Dates can be stored in a standard format, but displayed according to the required format. If the date is entered on a screen,...
Read more >Check If a String Is a Valid Date in Java - Baeldung
Check If a String Is a Valid Date in Java · 1. Overview · 2. Date Validation Overview · 3. Validate Using DateFormat...
Read more >KB-2022 Date format validation is not translated based on locale
Validations on date components display in US date format: "mm/dd/yyyy" . For example, if the system language is set to English (United Kingdom)...
Read more >Date.prototype.toLocaleDateString() - JavaScript | MDN
A string with a BCP 47 language tag, or an array of such strings. Corresponds to the locales parameter of the Intl.DateTimeFormat() constructor....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes, the #340 parses using only the specified format. It does not pass the input to the
Date
constructor as a fallback. For example:You see, that you do not need to provide the locale, but you need to know the Portuguese official date format. If you wanted to specify the format with the help of the locale and not so explicitly, this PR could join forces with #305 to specify a localizable date-only format, for example:
Of course, you would have to know, that “L” means date-only and how it translates in Portuguese 😃
From v1.8.7, you could check like this