Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
a777e585e8 | |||
56d5d3ab1c | |||
1e5a4bc3d3 | |||
3641de7ebd |
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@tp/tp-date-input",
|
||||
"version": "2.0.0",
|
||||
"version": "2.0.2",
|
||||
"description": "",
|
||||
"main": "tp-date-input.js",
|
||||
"scripts": {
|
||||
@ -13,8 +13,7 @@
|
||||
"author": "trading_peter",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"date-fns": "^2.0.0",
|
||||
"date-fns-tz": "^2.0.0",
|
||||
"luxon": "^3.0.0",
|
||||
"lit": "^3.0.0"
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
Reference in New Issue
Block a user