Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

on Mode change - Events goes blank #647

Open
codoffer opened this issue Feb 15, 2023 · 3 comments
Open

on Mode change - Events goes blank #647

codoffer opened this issue Feb 15, 2023 · 3 comments

Comments

@codoffer
Copy link

I am facing a weird issue with the calendar. I am giving an option to the user to change mode - from Default Monthly to Weekly. On changing the mode, I am not able to get the events with onTimeSelected.

Will I have to invoke or refresh the events?

I have tried with loadEvents() but all was in vain. Can you help with this issue?

 <calendar
          [eventSource]="eventSource"
          [calendarMode]="modeMonthActive ? 'month': 'week'"
          [currentDate]="calendar.currentDate"
          [showEventDetail]="calendar.showEventDetail"
          (onTitleChanged)="onViewTitleChanged($event)"
          (onTimeSelected)="loadDayClasses($event)"
          [monthviewDisplayEventTemplate]="templateMonth"
          [weekviewAllDayEventTemplate]="templateWeek"
          [weekviewHeaderTemplate]="templateWeekHeader"
          formatWeekTitle="MMMM yyyy"
          formatDayHeader="EEEEEE"
          step="30"
        >
        </calendar>
@twinssbc
Copy link
Owner

@codoffer you don't need to loadEvents again. How do you fill your eventSource array?

@codoffer
Copy link
Author

codoffer commented Feb 16, 2023

I am loading events from the server and pushing events to the eventSource variable. It's working fine with the month view. When I am toggling mode ('month' to 'week'), Events are converted to a blank array.

@twinssbc
Copy link
Owner

I think you could set the mode to 'week' at the beginning, then try insert some dummy event to see if it's working. So that you could tell if it's something with the events loaded from server.
Also there are two types of event, normal event and all day events, they have different requirement of startTime and endTime.
For normal event, startTime could just be current date time, like new Date(2023,1,17,7,53,00), but for all day event, it needs created from UTC time, new Date(Date.UTC(2023, 1, 17)).
https://github.com/twinssbc/Ionic2-Calendar#eventsource

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants