forked from verdnatura/salix-front
feat: VnInputDate & VnInputTime improviments
This commit is contained in:
parent
1ccf515509
commit
ea3effd7f4
|
@ -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"
|
||||
/>
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue