saddinamo / mc-datepicker
MCDatepicker JS library forked from https://github.com/mikecoj/MCDatepicker
Installs: 1
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 17
Language:JavaScript
Requires
- yiisoft/yii2: 2.*
This package is auto-updated.
Last update: 2024-05-11 20:54:35 UTC
README
Framework-agnostic, highly-customizable Vanilla JavaScript datepicker with zero dependencies.
Features
- 2 Modes: (modal, inline)
- Dependency free
- Custom weekday and month names
- Disable weekdays and specific dates
- Fully responsive/ Mobile friendly
Installation
Via NPM
npm install mc-datepicker --save
Using CDN
Include CDN links in the <head>
...
<link href="https://cdn.jsdelivr.net/npm/mc-datepicker/dist/mc-calendar.min.css" rel="stylesheet" /> <script src="https://cdn.jsdelivr.net/npm/mc-datepicker/dist/mc-calendar.min.js"></script>
Usage
<input id="datepicker" type="text">
If you’re using a bundler, e.g. webpack, you’ll need to import MCDatepicker
import MCDatepicker from 'mc-datepicker';
- Create a new instance, and attach it to an input field
const picker = MCDatepicker.create({ el: '#datepicker' });
- Customize the datepicker by adding more options
const picker = MCDatepicker.create({ el: '#datepicker', disableWeekends: true });
- Use methods to manipulate the datepicker
btn.onclick = () => picker.open();