$ npm install easyepoch
Examples
Open Picker
Toggle Light / Dark
Current theme: dark
const picker = new EasyEpoch ({ theme: 'dark' });
picker.setTheme ('light' );
picker.setTheme ('dark' );
picker.setTheme ({
bg: '#0a0a0a' ,
primary: '#ff6b6b' ,
secondary: '#ffd93d' ,
accent: '#ff6b6b' ,
text: '#f0f0f0' ,
});
Open Picker
Click the button to select a date...
const picker = new EasyEpoch ();
picker.on ('submit' , (date, readableDate) => {
console.log (readableDate);
});
document.querySelector ('button' ).addEventListener ('click' , () => {
picker.open ();
});
← →
Move the selection back / forward by one day
↑ ↓
Move by one week
Home End
Jump to the first / last day of the visible month
PgUp PgDn
Move by one month (clamps to last valid day)
Shift +PgUp / PgDn
Move by one year
Enter
Submit (same as OK)
Esc
Cancel and close
const picker = new EasyEpoch ('#my-container' , {
zIndex: 10
});
picker.on ('submit' , (date, readableDate) => {
document.querySelector ('input' ).value = readableDate;
});
Open Compact Picker
Click the button to try compact mode...
const picker = new EasyEpoch ({
compactMode: true
});
picker.on ('submit' , (date, readableDate) => {
console.log (readableDate);
});
Open Date-Only Picker
Click the button to pick a date without time...
const picker = new EasyEpoch ({
disableTimeSection: true
});
picker.on ('submit' , (date, readableDate) => {
console.log (readableDate);
});
Open Pre-selected Picker
Opens with Dec 31, 2026 pre-selected...
const picker = new EasyEpoch ({
selectedDate: new Date (2026 , 11 , 31 , 23 , 59 )
});
picker.on ('submit' , (date, readableDate) => {
console.log (readableDate);
});
Open Picker (today → +30 days)
Past dates and dates more than 30 days out are disabled...
const today = new Date ();
const in30 = new Date (today.getFullYear (), today.getMonth (), today.getDate () + 30 );
const picker = new EasyEpoch ({
minDate: today,
maxDate: in30,
});
Open Picker (with seconds)
Click the button to pick a date with HH:MM:SS time...
const picker = new EasyEpoch ({
showSeconds: true ,
});
picker.on ('submit' , (date, readableDate) => {
console.log (date.getSeconds ());
console.log (readableDate);
});
English
Français
Español
Deutsch
Open Picker
Pick a language, then open the picker...
const picker = new EasyEpoch ({
locale: {
months: ['Janvier' , 'Février' , 'Mars' , ],
days: ['Dimanche' , 'Lundi' , 'Mardi' , ],
daysShort: ['Dim' , 'Lun' , 'Mar' , ],
ok: 'Valider' ,
cancel: 'Annuler' ,
},
});
const start = new EasyEpoch ('#start-container' );
const end = new EasyEpoch ('#end-container' );
EasyEpoch.linkRange (start, end);
start.on ('submit' , (date, readableDate) => {
document.querySelector ('#start' ).value = readableDate;
});
end.on ('submit' , (date, readableDate) => {
document.querySelector ('#end' ).value = readableDate;
});
Open Picker
Future only
Past only
Clear bounds
Bounds: none. Click a button to constrain, then open to see the effect...
const picker = new EasyEpoch ();
picker.setMinDate (new Date ());
picker.setMinDate (undefined );
Open Picker
Event log appears here...
picker.on ('submit' , (date, readableDate) => {
log.append (`Selected: ${readableDate}` );
});
picker.on ('close' , () => {
log.append ('Picker was closed/cancelled' );
});