Datepicker
Every <input type="date" class="form-control"> gets a Moey calendar instead of the browser's — the same look everywhere, with keyboard support, ranges and quick picks. The real input stays in the page, so forms, required, min / max, value and change work exactly as before.
<label class="form-label" for="ship">Ship date</label>
<input class="form-control" id="ship" type="date" name="ship" value="2026-11-27">
- Keyboard: ↓ or Enter opens it; arrows move by day and week, Home / End to the start / end of the week, Page Up / Page Down by month (with Shift: by year), Enter picks, Esc closes.
- Language: month and day names, the date format and the first day of the week follow the page's
lang(try the Portuguese one below). - The value is always
YYYY-MM-DD, like a normal date input.data-moey-nativekeeps the browser's own picker.
Date range
Two date inputs in a .date-range become one field: pick the start, then the end. Wide screens show two months. data-moey-presets adds quick picks like "Last 7 days".
<label class="form-label" id="period">Report period</label>
<div class="date-range" aria-labelledby="period" data-moey-presets>
<input class="form-control" type="date" name="from" aria-label="From">
<input class="form-control" type="date" name="to" aria-label="To">
</div>
Days that can't be picked
min and max as usual, plus data-moey-disable with weekends and / or dates. For anything else, pass a function from code.
<input class="form-control" type="date" min="2026-11-24" max="2027-01-31"
data-moey-disable="weekends, 2026-12-24, 2026-12-25, 2027-01-01">
<script>
// Or any rule you like: no Mondays
Moey.datepicker('#pickup', { disable: (date) => date.getDay() === 1 });
</script>
With floating labels, input groups and sizes
It is a normal Moey field, so it works everywhere a .form-select does.
<div class="form-floating">
<input class="form-control" id="start" type="date">
<label for="start">Start date</label>
</div>
<div class="input-group">
<span class="input-group-text">Due</span>
<input class="form-control" type="date" aria-label="Due date">
<button class="btn" type="button">Remind me</button>
</div>
Inline calendar
data-moey-inline shows the calendar in the page — for booking pages and sidebars. Works for ranges too.
<input class="form-control" type="date" data-moey-inline aria-label="Appointment day">
Formats and languages
data-moey-format: short, medium (default), long or full. data-moey-week-start (0 = Sunday … 6) overrides the language's first day of the week.
<input class="form-control" type="date" data-moey-format="long">
<input class="form-control" type="date" data-moey-format="full" data-moey-week-start="1">
<div lang="pt-PT">
<input class="form-control" type="date" data-moey-format="long">
</div>
From code
const d = Moey.datepicker('#ship'); // the input (or a .date-range)
d.value = '2026-12-24'; // or ['2026-12-01', '2026-12-07'] for a range
d.open(); d.close();
// Setting the input directly works too, and the field updates:
document.querySelector('#ship').valueAsDate = new Date();
// Your own rules and quick picks
Moey.datepicker('#period', {
disable: (date) => date > new Date(),
presets: [{ label: 'Q4 2026', from: '2026-10-01', to: '2026-12-31' }],
});
input.addEventListener('change', () => console.log(input.value)); // "2026-12-24"
| Class / attribute | What it does |
|---|---|
input[type="date"].form-control | Gets the Moey calendar automatically |
.date-range with two date inputs | One field for a start and end date |
data-moey-presets | Quick picks on a range: today, yesterday, last 7 / 30 days, this / last month, this year |
min · max · data-moey-disable="weekends, 2026-12-25" | Days that can't be picked |
data-moey-inline | The calendar in the page instead of a field |
data-moey-format · data-moey-week-start · lang | How the date is written · first day of the week · language |
placeholder · data-moey-placeholder (range) | Text shown while empty |
data-moey-native | Keep the browser's date picker |