Skip to content
On this page

Localization

Localization options and label props

Info

  • If you use the component in the browser <script> tag, make sure to pass multi-word props with -, for example, formatLocale as format-locale and so on

locale

Set datepicker locale. Datepicker will use built in javascript locale formatter to extract month and weekday names

  • Type: string
  • Default: 'en-US'
Code Example
vue
<template>
    <Datepicker v-model="date" locale="de" cancelText="abbrechen" selectText="auswählen" />
</template>

<script>
import { ref } from 'vue';

export default {
    setup() {
        const date = ref(new Date());
        
        return {
            date,
        }
    }
}
</script>

format-locale

Specify localized format output. This prop uses Locale object from date-fns library

For more info about supported locales or adding a custom locale object, please visit date-fns documentation

  • Type: Locale
  • Default: null
Code Example
vue
<template>
    <Datepicker v-model="date" :format-locale="ja" format="E" />
</template>

<script>
import { ref } from 'vue';
import { ja } from 'date-fns/locale';

export default {
    setup() {
        const date = ref(new Date());
        
        return {
            date,
            ja,
        }
    }
}
</script>

select-text

Select text label in the action row

  • Type: string
  • Default: 'Select'
Code Example
vue
<template>
    <Datepicker v-model="date" select-text="Pick" />
</template>

<script>
import { ref } from 'vue';

export default {
    setup() {
        const date = ref(new Date());
        
        return {
            date,
        }
    }
}
</script>

cancel-text

Cancel text label in the action row

  • Type: string
  • Default: 'Cancel'
Code Example
vue
<template>
    <Datepicker v-model="date" cancel-text="Close" />
</template>

<script>
import { ref } from 'vue';

export default {
    setup() {
        const date = ref(new Date());
        
        return {
            date,
        }
    }
}
</script>

now-button-label

Change the text for now button

  • Type: string
  • Default: 'Now'
Code Example
vue
<template>
    <Datepicker v-model="date" show-now-button now-button-label="Current" />
</template>

<script>
import { ref } from 'vue';

export default {
    setup() {
        const date = ref();
        
        return {
            date,
        }
    }
}
</script>

week-num-name

Sets the label for the week numbers column

  • Type: string
  • Default: 'W'
Code Example
vue
<template>
    <Datepicker v-model="date" week-numbers week-num-name="We" />
</template>

<script>
import { ref } from 'vue';

export default {
    setup() {
        const date = ref(new Date());
        
        return {
            date,
        }
    }
}
</script>

aria-labels

Customize the language of the HTML aria-labels for localized accessibility

  • Type
ts
interface AriaLabels {
  toggleOverlay?: string;
  menu?: string;
  input?: string;
  calendarWrap?: string;
  calendarDays?: string;
  openTimePicker?: string;
  closeTimePicker?: string;
  incrementValue?: (type: 'hours' | 'minutes' | 'seconds') => string;
  decrementValue?: (type: 'hours' | 'minutes' | 'seconds') => string;
  openTpOverlay?: (type: 'hours' | 'minutes' | 'seconds') => string;
  amPmButton?: string;
  openYearsOverlay?: string;
  openMonthsOverlay?: string;
  nextMonth?: string;
  prevMonth?: string;
  day?: ({value}: {value: Date}) => string;
}
  • Default: {}
Code Example
vue
<template>
    <Datepicker v-model="date" :aria-labels="ariaLabels" />
</template>

<script>
import { ref } from 'vue';

export default {
    setup() {
        const date = ref();
        const ariaLabels = ref({ menu: 'Some custom menu label' })
        
        return {
          date,
          ariaLabels,
        }
    }
}
</script>

day-names

Provide custom labels for day names in the calendar header

Note

Make sure that provided array has a length of 7

  • Type: ((lang: string, weekStart: number) => string[]) | string[]
  • Default: null;
Code Example
vue
<template>
    <Datepicker v-model="date" :day-names="['1', '2', '3', '4', '5', '6', '7']" />
</template>

<script>
import { ref } from 'vue';

export default {
    setup() {
        const date = ref(new Date());
        
        return {
            date,
        }
    }
}
</script>

Released under the MIT License.