Parsing part was not migrated to luxon
This commit is contained in:
@ -291,7 +291,17 @@ class TpDateInput extends EventHelpers(ControlState(FormElement(LitElement))) {
|
||||
return;
|
||||
}
|
||||
|
||||
const date = parse(i0 + '-' + i1 + '-' + i2, this._inputAssign.join('-'), new Date());
|
||||
// Convert luxon format to match input assignment
|
||||
const luxonFormat = this._inputAssign.map(part => {
|
||||
switch (part) {
|
||||
case 'MM': return 'LL';
|
||||
case 'dd': return 'dd';
|
||||
case 'y': return 'yyyy';
|
||||
default: return part;
|
||||
}
|
||||
}).join('-');
|
||||
|
||||
const dt = DateTime.fromFormat(i0 + '-' + i1 + '-' + i2, luxonFormat);
|
||||
|
||||
if (dt.isValid) {
|
||||
this.inputs[0].invalid = false;
|
||||
@ -512,4 +522,4 @@ class TpDateInput extends EventHelpers(ControlState(FormElement(LitElement))) {
|
||||
}
|
||||
}
|
||||
|
||||
window.customElements.define('tp-date-input', TpDateInput);
|
||||
window.customElements.define('tp-date-input', TpDateInput);
|
Reference in New Issue
Block a user