Skip to content

Quarter picker (Q1 to Q4) ​

Four tiles for a year. The value is `2026-Q4`. The selection gives the first instant of the quarter and of the next one, so a query needs no date arithmetic.

The code ​

import { createDatePicker } from '@nervure/datetime';

createDatePicker('#field', {
  mode: 'quarter',
  value: '2026-Q4',
  onChange: (selection) => console.log(selection.value, selection.start, selection.end),
});

The value is '2026-Q4'. Read the guide for every option, and see every example.

What it does ​

  • The short word follows the language: Q4, T4 (French, Spanish, Italian), K4 (Dutch, Swedish).
  • Each tile shows its months. The current quarter is outlined.
  • min and max close the quarters that are wholly outside.

Why this one ​

  • No dependency, about 18 kB gzipped for every mode, zone and language.
  • Values are ISO 8601 text. Each selection also gives two instants, start and end, in the time zone.
  • 28 languages and right to left. Keyboard and screen readers.
  • Your CSS and your colours, through CSS variables. Light and dark.
  • The same picker in plain JavaScript, as a web component, in React and in Vue.