Skip to content

Latest commit

 

History

History
28 lines (18 loc) · 1.27 KB

README.md

File metadata and controls

28 lines (18 loc) · 1.27 KB

vanilla-datepicker

This is a rewrite of the foopicker (credits go to Sai Konero)

I did not give the vanilla-datepicker a special name. Just DatePicker, but you can call it in the main.js file whatever you want.

image

Why the rewrite?

Because there where a couple of bugs I needed to fix. When I was busy I thought why not write the whole thing as a javascript Module. I skipped some code so if you need it in another language, no problem the code is heavily commented so its easy to know where you will have to put Weeks, Months and format in your code.

Use the date picker

if you want to use the daypicker everywhere in your application:

main.js:  
import { DatePicker } from './modules/datepicker.js';
window.datePicker = new DatePicker();

app.js (or whatever...)
datePicker.initialize([element]);   
[element] can be every valid html element you want your datepicker connect to

Class

Its one class. Thats why you will need the initialize function. If you put the datePicker.initialize function in a loop and give the inputfields on a form a classname 'datepicker' then you can initialize all datepickers on that page in one loop.