|
@@ -4,8 +4,10 @@
|
|
|
:model-value="modelValue"
|
|
:model-value="modelValue"
|
|
|
range
|
|
range
|
|
|
multi-calendars
|
|
multi-calendars
|
|
|
- auto-apply
|
|
|
|
|
- locale="fr"
|
|
|
|
|
|
|
+ :auto-apply="autoApply"
|
|
|
|
|
+ :locale="i18n.locale"
|
|
|
|
|
+ :format-locale="fnsLocale"
|
|
|
|
|
+ :format="dateFormatPattern"
|
|
|
:start-date="today"
|
|
:start-date="today"
|
|
|
:teleport="true"
|
|
:teleport="true"
|
|
|
:alt-position="dateRangePickerAltPosition"
|
|
:alt-position="dateRangePickerAltPosition"
|
|
@@ -19,10 +21,11 @@
|
|
|
class="date-range-picker"
|
|
class="date-range-picker"
|
|
|
:style="style"
|
|
:style="style"
|
|
|
/>
|
|
/>
|
|
|
-<!-- :alt-position="dateRangePickerAltPosition"-->
|
|
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
|
|
|
+import { fr } from 'date-fns/locale';
|
|
|
|
|
+import DateUtils, {supportedLocales} from "~/services/utils/dateUtils";
|
|
|
|
|
|
|
|
const props = defineProps({
|
|
const props = defineProps({
|
|
|
modelValue: {
|
|
modelValue: {
|
|
@@ -38,10 +41,18 @@ const props = defineProps({
|
|
|
|
|
|
|
|
const emit = defineEmits(['update:modelValue'])
|
|
const emit = defineEmits(['update:modelValue'])
|
|
|
|
|
|
|
|
|
|
+const autoApply = false
|
|
|
|
|
+
|
|
|
const updateDateTimeRange = (value: [string, string]) => {
|
|
const updateDateTimeRange = (value: [string, string]) => {
|
|
|
emit('update:modelValue', value)
|
|
emit('update:modelValue', value)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+const i18n = useI18n()
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+const fnsLocale = DateUtils.getFnsLocale(i18n.locale.value as supportedLocales)
|
|
|
|
|
+const dateFormatPattern = DateUtils.getShortFormatPattern(i18n.locale.value as supportedLocales)
|
|
|
|
|
+
|
|
|
const today = new Date()
|
|
const today = new Date()
|
|
|
|
|
|
|
|
let style = '';
|
|
let style = '';
|
|
@@ -56,10 +67,11 @@ if (props.maxHeight !== null) {
|
|
|
const dateRangePickerAltPosition = (el: HTMLElement) => {
|
|
const dateRangePickerAltPosition = (el: HTMLElement) => {
|
|
|
let xOffset = 0
|
|
let xOffset = 0
|
|
|
const fullWidth = 500
|
|
const fullWidth = 500
|
|
|
|
|
+ const rightPadding = 30
|
|
|
const rect = el.getBoundingClientRect()
|
|
const rect = el.getBoundingClientRect()
|
|
|
-
|
|
|
|
|
- if ((rect.left + fullWidth + 20) > window.innerWidth) {
|
|
|
|
|
- xOffset = window.innerWidth - (rect.left + fullWidth + 20)
|
|
|
|
|
|
|
+
|
|
|
|
|
+ if ((rect.left + fullWidth + rightPadding) > window.innerWidth) {
|
|
|
|
|
+ xOffset = window.innerWidth - (rect.left + fullWidth + rightPadding)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return {
|
|
return {
|