Skip to content

Commit

Permalink
♻️ refactor(CGIDatePicker): ajustes para funcionamento correto
Browse files Browse the repository at this point in the history
  • Loading branch information
itsjofi committed Feb 22, 2024
1 parent afdf530 commit b28239c
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions cids/lib/components/CgiDatePicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
density="compact"
v-model="data"
:label="nome"
:rules="regras"
persistent-hint
v-maska:[mask]
@blur="blurTextField"
Expand All @@ -16,10 +17,7 @@
location="bottom left"
>
<template v-slot:activator="{ props: props }">
<v-icon
tabindex="-1"
v-bind="props"
>mdi-calendar</v-icon>
<v-icon tabindex="-1" v-bind="props">mdi-calendar</v-icon>
</template>

<v-date-picker
Expand All @@ -37,8 +35,8 @@

<script setup>
import dayjs from "dayjs";
import * as isBetween from "dayjs/plugin/isBetween";
import * as customParseFormat from "dayjs/plugin/customParseFormat";
import isBetween from "dayjs/plugin/isBetween";
import customParseFormat from "dayjs/plugin/customParseFormat";
import { computed, ref } from "vue";
dayjs.extend(customParseFormat);
Expand Down Expand Up @@ -107,12 +105,16 @@ const formatoMascara = computed(() => {
return formatos[props.tipo][props.formato];
});
const menu = ref(false);
const data = ref(
dayjs(props.modelValue, props.formato).format(
const formataValorInicial = () => {
if (!props.modelValue) return "";
return dayjs(props.modelValue, props.formato).format(
formatoMascara.value.formatoInterno
)
);
);
};
const menu = ref(false);
const data = ref(formataValorInicial());
const datePicker = ref(dayjs(props.modelValue, props.formato).toDate());
const mask = ref({ mask: props.tipo == "dia" ? "##/##/####" : "##/####" });
Expand Down

0 comments on commit b28239c

Please sign in to comment.