Year picker
Twelve years at a time. The value is `2026`. The arrows go twelve years back and forth.
The code
import { createDatePicker } from '@nervure/datetime';
createDatePicker('#field', {
mode: 'year',
value: '2026',
onChange: (selection) => console.log(selection.value, selection.start, selection.end),
});The value is '2026'. Read the guide for every option, and see every example.
What it does
- The selection gives the first instant of the year and of the next one.
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,
startandend, 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.