For the full documentation, visit the GitHub repository.
A lightweight JavaScript/TypeScript library for managing date selection with dynamic year, month, and day dropdowns. It automatically updates available options based on user selections to ensure valid dates are displayed.
- Dynamically populate year, month, and day dropdowns.
- Automatically adjusts days based on the selected month and year.
- Easy to integrate with customizable dropdown IDs and ranges.
- Simple to use and configure with pre-selection capabilities.
npm i simple-date-selector
<script src="https://unpkg.com/simple-date-selector@1.0.3/lib/index.js"></script>
Add the following dropdowns in your HTML.
<select id="yearId"></select>
<select id="month"></select>
<select id="day"></select>
// Assign custom IDs to the year, month, and day dropdowns.
// Use element(), only when you have custome IDs for the dropdowns.
dateSelector.element('yearId', 'monthId', 'dayId');
// Add a custom range yaers dropdowns
dateSelector.addYears('2000', 'now');
// Set pre-select values
dateSelector.initialize('2020', '7', '7');
For the full documentation, visit the GitHub repository.