|
|
@@ -7,35 +7,35 @@ Sélecteur de dates
|
|
|
<template>
|
|
|
<div class="date-picker">
|
|
|
<VueDatePicker
|
|
|
- :model-value="modelValue"
|
|
|
- :locale="locale"
|
|
|
- :format="dateFormatPattern"
|
|
|
- :format-locale="fnsLocale"
|
|
|
- :range="range"
|
|
|
- :multi-calendars="range"
|
|
|
- :enable-time-picker="withTimePicker"
|
|
|
- :auto-apply="autoApply"
|
|
|
- :auto-position="true"
|
|
|
- :start-date="today"
|
|
|
- close-on-scroll
|
|
|
- text-input
|
|
|
- :readonly="readonly"
|
|
|
- position="left"
|
|
|
- :teleport="true"
|
|
|
- :select-text="$t('select')"
|
|
|
- :cancel-text="$t('cancel')"
|
|
|
- input-class-name="date-picker-input"
|
|
|
- @update:model-value="$emit('update:modelValue', $event)"
|
|
|
- class="mb-6"
|
|
|
- />
|
|
|
+ :model-value="modelValue"
|
|
|
+ :locale="locale"
|
|
|
+ :format="dateFormatPattern"
|
|
|
+ :format-locale="fnsLocale"
|
|
|
+ :range="range"
|
|
|
+ :multi-calendars="range"
|
|
|
+ :enable-time-picker="withTimePicker"
|
|
|
+ :auto-apply="autoApply"
|
|
|
+ :auto-position="true"
|
|
|
+ :start-date="today"
|
|
|
+ close-on-scroll
|
|
|
+ text-input
|
|
|
+ :readonly="readonly"
|
|
|
+ position="left"
|
|
|
+ :teleport="true"
|
|
|
+ :select-text="$t('select')"
|
|
|
+ :cancel-text="$t('cancel')"
|
|
|
+ input-class-name="date-picker-input"
|
|
|
+ @update:model-value="$emit('update:modelValue', $event)"
|
|
|
+ class="mb-6"
|
|
|
+ />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
import { useI18n } from 'vue-i18n'
|
|
|
import DateUtils, { supportedLocales } from '~/services/utils/dateUtils'
|
|
|
-import type { PropType } from '@vue/runtime-core';
|
|
|
-import type { Locale } from 'date-fns';
|
|
|
+import type { PropType } from '@vue/runtime-core'
|
|
|
+import type { Locale } from 'date-fns'
|
|
|
|
|
|
const props = defineProps({
|
|
|
modelValue: {
|
|
|
@@ -58,19 +58,19 @@ const props = defineProps({
|
|
|
readonly: {
|
|
|
type: Boolean,
|
|
|
default: false,
|
|
|
- }
|
|
|
+ },
|
|
|
})
|
|
|
|
|
|
const i18n = useI18n()
|
|
|
|
|
|
const locale: Ref<string> = i18n.locale
|
|
|
|
|
|
-const fnsLocale: ComputedRef<Locale> = computed(
|
|
|
- () => DateUtils.getFnsLocale(locale.value as supportedLocales)
|
|
|
+const fnsLocale: ComputedRef<Locale> = computed(() =>
|
|
|
+ DateUtils.getFnsLocale(locale.value as supportedLocales),
|
|
|
)
|
|
|
|
|
|
-const dateFormatPattern: ComputedRef<string> = computed(
|
|
|
- () => DateUtils.getShortFormatPattern(locale.value as supportedLocales)
|
|
|
+const dateFormatPattern: ComputedRef<string> = computed(() =>
|
|
|
+ DateUtils.getShortFormatPattern(locale.value as supportedLocales),
|
|
|
)
|
|
|
|
|
|
const today = new Date()
|