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
Setting the datepicker with locale to e.g. de the date format changes from MM/DD/YY to DD/MM/YY.
I can type the date via the input field manually, e.g. 6th Dec 17 in 'de' ==> 06/12/17. When I change the input manually to 07/12/17 I get as a result in the calendar 12th Jul 17 - because date and months are switched.
Additionally (not directly related but nevertheless) I wanna ask if its not easy possible to add an Error check of the input - and assign it to a specific class (when the input fails to be converted to an appropriate date)
Since I know the input is a pain in the a** and the details get someone clz to nut I can provide some sample code as I did the conversion & checks (and validation of the input) - just as an inspiration...
const val = this.internalDateString.trim();
if (val) {
let inValid = !moment(val, this.dateFormat, true).isValid();
if (!inValid) {
const test = moment(val, this.dateFormat, true).toDate();
if (this.minDate && test < this.minDate) {
inValid = true;
} else if (this.maxDate && test > this.maxDate) {
inValid = true;
}
if (!inValid) {
// users input is a valid date (according to the format) ==> proceed....
this.internalDate = test;
}
}
this.isInValid = inValid; // used for hte bootstrap-class [has-error]
// update the model
this.onChange(this.internalDate);
The text was updated successfully, but these errors were encountered:
Error check of the input - sure you can do any custom validation on input
Manual input parse is known and should be published next, there are similar issue to this one
Setting the datepicker with locale to e.g.
de
the date format changes fromMM/DD/YY
toDD/MM/YY
.I can type the date via the input field manually, e.g. 6th Dec 17 in 'de' ==>
06/12/17
. When I change the input manually to07/12/17
I get as a result in the calendar 12th Jul 17 - because date and months are switched.Additionally (not directly related but nevertheless) I wanna ask if its not easy possible to add an Error check of the input - and assign it to a specific class (when the input fails to be converted to an appropriate date)
Since I know the input is a pain in the a** and the details get someone clz to nut I can provide some sample code as I did the conversion & checks (and validation of the input) - just as an inspiration...
The text was updated successfully, but these errors were encountered: