A zero-dependency date picker for vanilla JavaScript. Drop in one script tag, point it at an input, done. It follows your page's light or dark theme on its own — flip the switch above and watch.
<script src="https://cdn.jsdelivr.net/gh/vanilla-ui-kit/components/datepicker/datepicker.js"></script>
<input id="date">
<script>new DatePicker('#date')</script>
Every card is live — click into the inputs.
Defaults: ISO format, browser locale, automatic theme.
new DatePicker('#ex-basic')
Token formats, month names from Intl — no locale bundles.
new DatePicker('#ex-format', { format: 'MMMM D, YYYY' })
new DatePicker('#ex-locale', { format: 'DD/MM/YYYY', locale: 'fr' })
Two clicks, hover preview, one input.
new DatePicker('#ex-range', { range: true })
Side-by-side months with a quick-select rail — the booking-site classic.
new DatePicker('#ex-multipane', {
range: true,
panes: 2,
presets: true // or your own [{label, range}]
})
The whole thing — range, two panes, presets — from attributes alone.
<input data-datepicker data-range
data-panes="2"
data-presets="last7,last30,thisMonth,lastMonth">
Bookable window: today through +90 days, weekends off.
new DatePicker('#ex-min', {
min: 'today',
max: new Date(Date.now() + 90 * 864e5),
disabledDays: [0, 6]
})
ISO-8601 week numbers in the left rail.
new DatePicker('#ex-weeks', { weekNumbers: true, firstDay: 1 })
Pin a theme regardless of the page, or restyle the accent.
new DatePicker('#ex-dark', { theme: 'dark' })
new DatePicker('#ex-accent', { accent: '#0f766e' })
Data attributes only — no script written for this input.
<input data-datepicker
data-format="DD MMM YYYY"
data-min="today">
Callbacks, custom events, and instance methods.
const dp = new DatePicker('#ex-events', {
onSelect: (date, text) => show(text)
})
dp.open()
dp.setDate('today')
dp.getDate() // Date object
Point it at a container instead of an input.
<div id="ex-inline"></div>
new DatePicker('#ex-inline', {
onSelect: (d, text) => console.log(text)
})