ember-validators
ember-validators copied to clipboard
[Bug] `date value is not finite in DateTimeFormat.format()` when passing locale `de` & specific `format`
Description
Passing a locale
like de
, it
... with a specific format
into before
/ onOrBefore
/ after
/ onOrAfter
validator is causing this error:
date value is not finite in DateTimeFormat.format()
.
This occures, because the parseAsDate
is passing the locale
to parseDate
function, which returns in for locale en the date format 1.1.2015
.
new Date('1.1.2015')
returns a Invalid Date
and this produces this error.
https://github.com/rwwagner90/ember-validators/blob/1282748147a691f3fcffacb0c478a676cc9e309a/addon/date.js#L141-L146
Fix:
There is not necessary to pass locale
to parseAsDate
, because parseAsDate
returns always a new Date
object.
We can always pass en-us
in parseDate
function.
Enviroment
Ember: v3.28.x
/ v4.x
Ember Validators: v4.1.2
@RobbieTheWagner is there possible to get a release with this fix?