Skip to content

Manually Call prevDate, nextDate, prevMonth and nextMonth. #2813

Closed Answered by Eonasdan
Anzil-Aufait asked this question in Q&A
Discussion options

You must be logged in to vote

You might be confused about what you want to do. If you want to change the view date you can do something like this:

prevDayButton.addEventListener('click', function (e) {
  let currentDate = datetimepicker1.viewDate.clone.manipulate(-1, 'date');
  datetimepicker1.viewDate = currentDate;
  console.log('prevDay: ', datetimepicker1, datetimepicker1.viewDate);
});

nextDayButton.addEventListener('click', function (e) {
  let currentDate = datetimepicker1.viewDate.clone.manipulate(1, 'date');
  datetimepicker1.viewDate = currentDate;
  console.log('nextDay: ', datetimepicker1, datetimepicker1.viewDate);
});

prevMonthButton.addEventListener('click', function (e) {
  let currentDate = datetime…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@Anzil-Aufait
Comment options

@Anzil-Aufait
Comment options

@Eonasdan
Comment options

Answer selected by Anzil-Aufait
@Anzil-Aufait
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
2 participants