@@ -288,7 +288,7 @@ import {
288288 getFirstDay ,
289289} from ' @nextcloud/l10n'
290290import VueDatePicker from ' @vuepic/vue-datepicker'
291- import { computed , useTemplateRef } from ' vue'
291+ import { computed , useTemplateRef , warn , watchEffect } from ' vue'
292292import NcIconSvgWrapper from ' ../NcIconSvgWrapper/NcIconSvgWrapper.vue'
293293import NcTimezonePicker from ' ../NcTimezonePicker/NcTimezonePicker.vue'
294294import { t } from ' ../../l10n.ts'
@@ -353,7 +353,9 @@ const props = withDefaults(defineProps<{
353353
354354 /**
355355 * The locale to use for formatting the shown dates.
356- * By default the users current Nextcloud locale is used.
356+ *
357+ * @deprecated This property is no longer used and will be ignored because this component will always use the current Nextcloud locale.
358+ * @see https://github.com/nextcloud-libraries/nextcloud-vue/issues/8639
357359 */
358360 locale? : string
359361
@@ -425,7 +427,7 @@ const props = withDefaults(defineProps<{
425427 ariaLabel: t (' Datepicker input' ),
426428 ariaLabelMenu: t (' Datepicker menu' ),
427429 format: undefined ,
428- locale: getCanonicalLocale () ,
430+ locale: undefined ,
429431 max: undefined ,
430432 min: undefined ,
431433 minuteStep: 10 ,
@@ -451,6 +453,13 @@ const emit = defineEmits<{
451453 blur: []
452454}>()
453455
456+ const realLocale = getCanonicalLocale ()
457+ watchEffect (() => {
458+ if (props .locale !== undefined ) {
459+ warn (' [NcDateTimePicker] The `locale` property is no longer used and will be ignored.' )
460+ }
461+ })
462+
454463const targetElement = useTemplateRef (' target' )
455464const pickerInstance = useTemplateRef (' picker' )
456465
@@ -547,15 +556,15 @@ const realFormat = computed<LibraryFormatOptions>(() => {
547556
548557 let formatter: Intl .DateTimeFormat | undefined
549558 if (props .type === ' date' || props .type === ' date-range' ) {
550- formatter = new Intl .DateTimeFormat (getCanonicalLocale () , { dateStyle: ' medium' })
559+ formatter = new Intl .DateTimeFormat (realLocale , { dateStyle: ' medium' })
551560 } else if (props .type === ' time' || props .type === ' time-range' ) {
552- formatter = new Intl .DateTimeFormat (getCanonicalLocale () , { timeStyle: ' short' })
561+ formatter = new Intl .DateTimeFormat (realLocale , { timeStyle: ' short' })
553562 } else if (props .type === ' datetime' || props .type === ' datetime-range' ) {
554- formatter = new Intl .DateTimeFormat (getCanonicalLocale () , { dateStyle: ' medium' , timeStyle: ' short' })
563+ formatter = new Intl .DateTimeFormat (realLocale , { dateStyle: ' medium' , timeStyle: ' short' })
555564 } else if (props .type === ' month' ) {
556- formatter = new Intl .DateTimeFormat (getCanonicalLocale () , { year: ' numeric' , month: ' 2-digit' })
565+ formatter = new Intl .DateTimeFormat (realLocale , { year: ' numeric' , month: ' 2-digit' })
557566 } else if (props .type === ' year' ) {
558- formatter = new Intl .DateTimeFormat (getCanonicalLocale () , { year: ' numeric' })
567+ formatter = new Intl .DateTimeFormat (realLocale , { year: ' numeric' })
559568 }
560569
561570 if (formatter ) {
@@ -777,7 +786,7 @@ function sameDay(a: Date, b: Date): boolean {
777786 :dayNames
778787 :placeholder =" placeholder ?? placeholderFallback "
779788 :format =" realFormat "
780- :locale
789+ :locale = " realLocale "
781790 :minDate =" calcMinMaxTime .minDate "
782791 :maxDate =" calcMinMaxTime .maxDate "
783792 :minTime =" calcMinMaxTime .minTime "
0 commit comments