#6917 - inputDate_inputTime_improviments #552
|
@ -78,7 +78,7 @@ const defaultComponents = {
|
||||||
date: {
|
date: {
|
||||||
component: markRaw(VnInputDate),
|
component: markRaw(VnInputDate),
|
||||||
attrs: {
|
attrs: {
|
||||||
readonly: true,
|
readonly: !$props.isEditable,
|
||||||
disable: !$props.isEditable,
|
disable: !$props.isEditable,
|
||||||
style: 'min-width: 125px',
|
style: 'min-width: 125px',
|
||||||
class: 'fit',
|
class: 'fit',
|
||||||
|
|
|
@ -41,11 +41,16 @@ const formattedTime = computed({
|
||||||
let time = value;
|
let time = value;
|
||||||
if (time) {
|
if (time) {
|
||||||
if (time?.length > 5) time = dateToTime(time);
|
if (time?.length > 5) time = dateToTime(time);
|
||||||
|
else {
|
||||||
|
time = time.padEnd(5, '0');
|
||||||
|
if (!time.includes(':'))
|
||||||
|
time = time.substring(0, 2) + ':' + time.substring(3, 4);
|
||||||
|
}
|
||||||
if (!props.timeOnly) {
|
if (!props.timeOnly) {
|
||||||
alexm marked this conversation as resolved
|
|||||||
const hours = time.split(':');
|
const hours = time.split(':');
|
||||||
alexm marked this conversation as resolved
Outdated
jsegarra
commented
const [hh, mm] = time.split en vez de hacer hours[0] y hours[1] const [hh, mm] = time.split en vez de hacer hours[0] y hours[1]
|
|||||||
const date = new Date(model.value);
|
const date = new Date(model.value);
|
||||||
date.setHours(hours[0], hours[1], 0);
|
date.setHours(hours[0] ?? 0, hours[1] ?? 0, 0);
|
||||||
alexm marked this conversation as resolved
Outdated
jsegarra
commented
En que casos puede ser undefined? En que casos puede ser undefined?
|
|||||||
time = date.toISOString();
|
time = date?.toISOString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
model.value = time;
|
model.value = time;
|
||||||
|
@ -74,6 +79,7 @@ watch(
|
||||||
:class="{ required: $attrs.required }"
|
:class="{ required: $attrs.required }"
|
||||||
jsegarra
commented
porque 10? porque 10?
alexm
commented
pq menos de 10 ja es 09, 08, 07, etc pq menos de 10 ja es 09, 08, 07, etc
|
|||||||
style="min-width: 100px"
|
style="min-width: 100px"
|
||||||
:rules="$attrs.required ? [requiredFieldRule] : null"
|
:rules="$attrs.required ? [requiredFieldRule] : null"
|
||||||
|
@click="isPopupOpen = false"
|
||||||
jsegarra
commented
Porque hay 2? Porque hay 2?
alexm
commented
Con 1 no funcionaba entiendo que vue aún no ha actualizado el valor con 1 solo Con 1 no funcionaba entiendo que vue aún no ha actualizado el valor con 1 solo
|
|||||||
>
|
>
|
||||||
<template #append>
|
<template #append>
|
||||||
<QIcon
|
<QIcon
|
||||||
|
@ -90,7 +96,12 @@ watch(
|
||||||
isPopupOpen = false;
|
isPopupOpen = false;
|
||||||
"
|
"
|
||||||
/>
|
/>
|
||||||
<QIcon name="Schedule" class="cursor-pointer" />
|
<QIcon
|
||||||
|
name="Schedule"
|
||||||
|
class="cursor-pointer"
|
||||||
|
@click="isPopupOpen = !isPopupOpen"
|
||||||
|
:title="t('Open time')"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
<QMenu
|
<QMenu
|
||||||
transition-show="scale"
|
transition-show="scale"
|
||||||
|
@ -99,6 +110,7 @@ watch(
|
||||||
anchor="bottom left"
|
anchor="bottom left"
|
||||||
self="top start"
|
self="top start"
|
||||||
:no-focus="true"
|
:no-focus="true"
|
||||||
|
:no-parent-event="true"
|
||||||
>
|
>
|
||||||
<QTime v-model="formattedTime" mask="HH:mm" landscape now-btn />
|
<QTime v-model="formattedTime" mask="HH:mm" landscape now-btn />
|
||||||
</QMenu>
|
</QMenu>
|
||||||
|
@ -114,3 +126,7 @@ watch(
|
||||||
border-style: solid;
|
border-style: solid;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
<i18n>
|
||||||
|
es:
|
||||||
|
Open time: Abrir tiempo
|
||||||
|
</i18n>
|
||||||
|
|
Loading…
Reference in New Issue
(comentario/sugerncia) Okey, con regExp podria ser asi '1200'.replace(/^(\d{2})(\d{2})/, "$1:$2")