perf: minor changes
gitea/salix-front/pipeline/pr-master This commit is unstable Details

This commit is contained in:
Javier Segarra 2025-03-12 23:47:31 +01:00
parent 23670debd1
commit f4c22938c7
2 changed files with 20 additions and 22 deletions

View File

@ -27,12 +27,20 @@ export default boot(() => {
const date = new Date(Date.vnUTC());
return new Date(date.getFullYear(), date.getMonth() + 1, 0);
};
Date.getCurrentDateTimeFormatted = (
endOfDay = true,
options = { iso: true, mask: 'DD-MM-YYYY HH:mm' },
options = {
startOfDay: false,
endOfDay: true,
iso: true,
mask: 'DD-MM-YYYY HH:mm',
},
) => {
const date = Date.vnUTC();
if (endOfDay) {
if (options.startOfDay) {
date.setHours(0, 0, 0);
}
if (options.endOfDay) {
date.setHours(23, 59, 0);
}
if (options.iso) {
@ -40,8 +48,8 @@ export default boot(() => {
}
return formatDate(date, options.mask);
};
Date.convertToISODateTime = (dateTimeStr) => {
// Convertir de formato "DD-MM-YYYY HH:mm" a ISO
const [datePart, timePart] = dateTimeStr.split(' ');
const [day, month, year] = datePart.split('-');
const [hours, minutes] = timePart.split(':');

View File

@ -1,9 +1,6 @@
<script setup>
import { onMounted, watch, computed, ref, useAttrs } from 'vue';
import { computed, useAttrs } from 'vue';
import { date } from 'quasar';
import VnDate from './VnDate.vue';
import { useRequired } from 'src/composables/useRequired';
import VnTime from './VnTime.vue';
const $attrs = useAttrs();
const model = defineModel({ type: [Date] });
@ -47,32 +44,25 @@ const selectedDate = computed({
class="vn-input-date"
placeholder="dd/mm/aaaa HH:mm"
v-bind="{ ...$attrs, ...styleAttrs }"
:class="{ required: isRequired }"
:rules="mixinRules"
:clearable="false"
@click="isPopupOpen = !isPopupOpen"
@keydown="isPopupOpen = false"
hide-bottom-space
:data-cy="$attrs.dataCy ?? $attrs.label + '_inputDate'"
:data-cy="$attrs.dataCy ?? $attrs.label + '_inputDateTime'"
>
<template #prepend>
<QIcon name="today" size="xs">
<QPopupProxy cover transition-show="scale" transition-hide="scale">
<VnDate
:mask="mask"
v-model="selectedDate"
></VnDate> </QPopupProxy
></QIcon>
<VnDate :mask="mask" v-model="selectedDate" />
</QPopupProxy>
</QIcon>
</template>
<template #append>
<QIcon name="access_time" size="xs">
<QPopupProxy cover transition-show="scale" transition-hide="scale">
<VnTime
format24h
:mask="mask"
v-model="selectedDate"
></VnTime> </QPopupProxy
></QIcon>
<VnTime format24h :mask="mask" v-model="selectedDate" />
</QPopupProxy>
</QIcon>
</template>
</QInput>
</div>