⚡ Zero Dependencies · Pure Vanilla JS

FlexiDatepicker

A lightweight, flexible, and powerful date picker with four selection modes — single, multiple, range, and multi-range. No dependencies required.

Try it Live Get Started
~5.5kB
Minified + Gzipped
4
Selection Modes
0
Dependencies
MIT
License

Everything you need

Powerful features packed into a tiny, dependency-free package.

📅

4 Selection Modes

Single date, multiple dates, date range, and multi-range selection — all out of the box.

Zero Dependencies

Pure vanilla JavaScript. No jQuery, no Moment.js, no bloat. Just drop it in and go.

🎨

Fully Customizable

Extensive configuration options for display, restrictions, callbacks, and formatting.

🚫

Date Restrictions

Disable specific dates, date ranges, past/future dates, and set min/max boundaries.

🌍

i18n Support

Built-in internationalization with locale support for month/day names worldwide.

Accessible

ARIA-compliant markup for screen readers and assistive technology support.

📱

Responsive

Works seamlessly on all screen sizes and device types, including mobile and tablet.

🗓️

Dual Calendar

Show two months side-by-side for effortless range selection across month boundaries.

Interactive Demo

Try each selection mode live. Click a tab to switch.

No date selected yet.
JavaScript
new FlexiDatepicker('#demo-single', {
  mode: 'single',
  dateFormat: 'MMM d, yyyy',
  onSelectionChange: function(data) {
    // data.dates — array of selected dates
    console.log(data.dates);
  }
});
No dates selected yet.
JavaScript
new FlexiDatepicker('#demo-multiple', {
  mode: 'multiple',
  showSelectWeekdays: true,
  showSelectWeekends: true,
  showSelectAllDays: true,
  onSelectionChange: function(data) {
    console.log('Dates:', data.dates);
  }
});
No range selected yet.
JavaScript
new FlexiDatepicker('#demo-range', {
  mode: 'range',
  dualCalendar: true,
  dateFormat: 'MM/dd/yyyy',
  onSelectionChange: function(data) {
    if (data.ranges.length) {
      const r = data.ranges[0];
      console.log(`From: ${r.start} — To: ${r.end}`);
    }
  }
});
No ranges selected yet.
JavaScript
new FlexiDatepicker('#demo-multirange', {
  mode: 'multi-range',
  showSelectWeekdays: true,
  showSelectWeekends: true,
  dualCalendar: true,
  onSelectionChange: function(data) {
    console.log('Ranges:', data.ranges);
    console.log('All dates:', data.dates);
  }
});

Installation

Add FlexiDatepicker to your project in seconds.

📦 npm
npm install flexidatepicker
🧶 yarn
yarn add flexidatepicker
🌐 CDN (jsDelivr)
<link rel="stylesheet" href=
  "https://cdn.jsdelivr.net/gh/
leoanangmh/flexidatepicker@latest/
dist/flexidatepicker.min.css">

<script src=
  "https://cdn.jsdelivr.net/gh/
leoanangmh/flexidatepicker@latest/
dist/flexidatepicker.umd.min.js">
</script>
📁 ES Module
import FlexiDatepicker
  from 'flexidatepicker';

Configuration Options

All available options with their defaults and descriptions.

Basic Options

OptionTypeDefaultDescription
modeString'multi-range'Selection mode: single, multiple, range, multi-range
localeString'en-US'Locale for date formatting (e.g. fr-FR, ja-JP)
dateFormatString'MMM d, yyyy'Date display format pattern
dualCalendarBooleanfalseShow two months side-by-side

Display Options

OptionTypeDefaultDescription
showClearAllBooleantrueShow "Clear All" button
showSelectWeekdaysBooleantrueShow "Select Weekdays" button (multiple/multi-range)
showSelectWeekendsBooleantrueShow "Select Weekends" button (multiple/multi-range)
showSelectAllDaysBooleantrueShow "Select All Days" button (multiple/multi-range)
selectedDatesDisplaySelectorStringnullCSS selector for an external display element

Date Restrictions

OptionTypeDefaultDescription
disabledDatesArray[]Dates to disable — strings (YYYY-MM-DD) or objects with from/to
disablePastBooleanfalseDisable all dates before today
disableFutureBooleanfalseDisable all dates after today
minDateStringnullMinimum selectable date (YYYY-MM-DD)
maxDateStringnullMaximum selectable date (YYYY-MM-DD)

Date Format Patterns

PatternDescriptionExample
yyyy4-digit year2025
yy2-digit year25
MMMMFull month nameJanuary
MMMShort month nameJan
MM2-digit month01
MMonth number1
dd2-digit day05
dDay number5