I would like to use the datepicker easepick.
I would like to preset a date range:
current date (=startDate) and current date + 2 years (=endDate).
This date range should be shown in the field.
Then the user should be able to pick his own date range.
And at last step I would like to get the startDate and the endDate (eather the preset dates or if given the ones chosen by the user) and save it in a variable.
If the user changes his date range the variables should update too.
const picker = new easepick.create({
element: document.getElementById('datepicker'),
css: [
'https://cdn.jsdelivr.net/npm/@easepick/bundle@1.2.1/dist/index.css',
],
calendars: 2,
grid: 2,
setup(picker) {
picker.on('select', (e) => {
});
},
plugins: ['LockPlugin','RangePlugin'],
LockPlugin: {
minDate: new Date(),
},
RangePlugin: {
tooltip: true,
startDate: new Date(),
endDate: new Date().add(2, 'years');,
locale: {
one: 'day',
other: 'days',},
},
});
var startDate = picker.getStartDate().format('YYYY-MM-DD');
var endDate = picker.getEndDate().format('YYYY-MM-DD');
Thank you in advance for your help!