Date picker

A date or a range in a button with the formatted date, and a calendar in a popover.

Single

An outline button with the date written in the locale; the calendar opens under it and closes on a pick.

<script setup>
import { ref } from 'vue';
import { DatePicker } from '@aisgroup/design/ui/date-picker';
import { Field, FieldLabel } from '@aisgroup/design/ui/field';
const date = ref();
</script>

<template>
  <Field class="w-auto">
    <FieldLabel for="dp-delivery">Delivery date</FieldLabel>
    <DatePicker id="dp-delivery" v-model="date" />
  </Field>
</template>

Range

A period, as a filter above a table: both ends in one button, two months side by side.

<script setup>
import { ref } from 'vue';
import { getLocalTimeZone, today } from '@internationalized/date';
import { DateRangePicker } from '@aisgroup/design/ui/date-picker';
const end = today(getLocalTimeZone());
const period = ref({ start: end.subtract({ days: 6 }), end });
</script>

<template>
  <DateRangePicker v-model="period" />
</template>

Locale

The locale sets the language, the date format and the first day of the week.

<script setup>
import { ref } from 'vue';
import { getLocalTimeZone, today } from '@internationalized/date';
import { DatePicker } from '@aisgroup/design/ui/date-picker';
const date = ref(today(getLocalTimeZone()));
</script>

<template>
  <DatePicker v-model="date" locale="es-ES" placeholder="Elige una fecha" :format-options="{ dateStyle: 'long' }" />
</template>

Type to search the guide.