Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
a777e585e8 | |||
56d5d3ab1c | |||
1e5a4bc3d3 | |||
3641de7ebd |
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@tp/tp-date-input",
|
"name": "@tp/tp-date-input",
|
||||||
"version": "2.0.0",
|
"version": "2.0.2",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "tp-date-input.js",
|
"main": "tp-date-input.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@ -13,8 +13,7 @@
|
|||||||
"author": "trading_peter",
|
"author": "trading_peter",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"date-fns": "^2.0.0",
|
"luxon": "^3.0.0",
|
||||||
"date-fns-tz": "^2.0.0",
|
|
||||||
"lit": "^3.0.0"
|
"lit": "^3.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -291,7 +291,17 @@ class TpDateInput extends EventHelpers(ControlState(FormElement(LitElement))) {
|
|||||||
return;
|
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) {
|
if (dt.isValid) {
|
||||||
this.inputs[0].invalid = false;
|
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