diff --git a/src/components/VnTable/VnColumn.vue b/src/components/VnTable/VnColumn.vue index da4687d32..3af58226f 100644 --- a/src/components/VnTable/VnColumn.vue +++ b/src/components/VnTable/VnColumn.vue @@ -78,7 +78,7 @@ const defaultComponents = { date: { component: markRaw(VnInputDate), attrs: { - readonly: true, + readonly: !$props.isEditable, disable: !$props.isEditable, style: 'min-width: 125px', class: 'fit', diff --git a/src/components/VnTable/VnTable.vue b/src/components/VnTable/VnTable.vue index dc5410e93..97053184a 100644 --- a/src/components/VnTable/VnTable.vue +++ b/src/components/VnTable/VnTable.vue @@ -407,7 +407,7 @@ defineExpose({ diff --git a/src/components/common/VnInputDate.vue b/src/components/common/VnInputDate.vue index 72898483f..6e57a8a53 100644 --- a/src/components/common/VnInputDate.vue +++ b/src/components/common/VnInputDate.vue @@ -44,15 +44,18 @@ const formattedDate = computed({ let newDate; if (value) { // parse input - if (value.includes('/') && value.length >= 10) { - if (value.at(2) == '/') value = value.split('/').reverse().join('/'); - value = date.formatDate( - new Date(value).toISOString(), - 'YYYY-MM-DDTHH:mm:ss.SSSZ' - ); + if (value.includes('/')) { + if (value.length == 6) value = value + new Date().getFullYear(); + if (value.length >= 10) { + if (value.at(2) == '/') value = value.split('/').reverse().join('/'); + value = date.formatDate( + new Date(value).toISOString(), + 'YYYY-MM-DDTHH:mm:ss.SSSZ' + ); + } } - let ymd = value.split('-').map((e) => parseInt(e)); - newDate = new Date(ymd[0], ymd[1] - 1, ymd[2]); + const [year, month, day] = value.split('-').map((e) => parseInt(e)); + newDate = new Date(year, month - 1, day); if (model.value) { const orgDate = model.value instanceof Date ? model.value : new Date(model.value); @@ -107,7 +110,12 @@ watch( isPopupOpen = false; " /> - + - + + es: + Open date: Abrir fecha + diff --git a/src/components/common/VnInputTime.vue b/src/components/common/VnInputTime.vue index def5dda51..adb6ef68c 100644 --- a/src/components/common/VnInputTime.vue +++ b/src/components/common/VnInputTime.vue @@ -1,5 +1,5 @@