0
0
Fork 0

feat: VnInputDate & VnInputTime improviments

This commit is contained in:
Alex Moreno 2024-07-15 12:33:58 +02:00
parent 1ccf515509
commit ea3effd7f4
2 changed files with 21 additions and 9 deletions

View File

@ -407,7 +407,7 @@ defineExpose({
<VnTableColumn
:column="col"
:row="row"
:is-editable="false"
:is-editable="col.isEditable ?? isEditable"
v-model="row[col.name]"
component-prop="columnField"
/>

View File

@ -44,12 +44,15 @@ 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]);
@ -107,7 +110,12 @@ watch(
isPopupOpen = false;
"
/>
<QIcon name="event" class="cursor-pointer" />
<QIcon
name="event"
class="cursor-pointer"
@click="isPopupOpen = !isPopupOpen"
:title="t('Open date')"
/>
</template>
<QMenu
transition-show="scale"
@ -116,6 +124,7 @@ watch(
anchor="bottom left"
self="top start"
:no-focus="true"
:no-parent-event="true"
>
<QDate
v-model="popupDate"
@ -132,7 +141,6 @@ watch(
</QInput>
</div>
</template>
<style lang="scss">
.vn-input-date.q-field--standard.q-field--readonly .q-field__control:before {
border-bottom-style: solid;
@ -142,3 +150,7 @@ watch(
border-style: solid;
}
</style>
<i18n>
es:
Open date: Abrir fecha
</i18n>