so my goal is to show all the days of a selected year. Since january to december, so that the user can pick or view the dates on that year. For that, I’m using ion2-calendar.
So far i have this:
date: Date = new Date();
async openCalendar() {
const options: CalendarModalOptions = {
title: 'Plano de Férias',
//defaultDate: new Date(2019,0,1),
pickMode: 'multi',
color: 'primary',
weekdays : ['D', 'S', 'T', 'Q', 'Q', 'S', 'S'],
weekStart : 1,
canBackwardsSelected: false,
closeLabel : 'Fechar',
doneLabel : 'OK',
disableWeeks : [0,6],
from : new Date(2019,0,1),
to : new Date(2019,11,31)
};
const myCalendar = await this.modalCtrl.create({
component: CalendarModal,
componentProps: { options },
});
myCalendar.present();
const event: any = await myCalendar.onDidDismiss();
const { data: date, role } = event;
if (role === 'done') {
this.date = date.dateObj;
}
console.log(date);
console.log('role', role);}
With this code, wich the from:new Date(2019,0,1), to:new Date(2019,11,31)
means that the start date is the first of january and the last is the 31st of december of 2019, the month december dont show, either do the january of 2020, but feb and so on do.
If i change the code to from:new Date(2019,1,1), to:new Date(2019,11,31)
, The Output is what i Want, but there’s no january month.
I don’t know if it is a bug, or if i’m doing something wrong, but so far i did not find an apropriate answer. If you know some plugin for ionic4, that looks like this, share it. Thank you for your time in advance.