watch?v=uiQjRcGoZZo
Hi Audrie,
I think I found an issue with the Calendar template. Everything seems to work at first glance, but if you look closer, any calendar entry that is set as "all day" shows on the day prior to the actual event. For instance, "Columbus day" shows on the 7th of October instead of the 8th as it should. This seems to be the case for any calendar (my personal calendar, the US Holiday calendar, etc). Any event I put in Outlook as an "all day" event will show on the previous day.
I have attached a screen shot to illustrate.
How do we fix this. I have tried a bunch of things but haven't come up with the correct universal solution. Please advise. Thanks.
Ed
@Anonymous
I just tried the same and I am getting the same error. It showed 8 PM on mine. I am guessing there is some issue with the time zone. as 8 PM Eastern means 12 midnight GMT. Need to do some tweaking around that. Will let you know once I figure it out.
Good catch though!
Vivek Bavishi aka That API Guy
PowerApps and Flow MVP
Blog | Twitter | YouTube | Community Profile | GitHub
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Anonymous
After further digging into this issue, I saw that all the events are created in my local time zone, however, the All-day events are created in UTC.
So, This is wha you need to do -
1. Create a separate collection -'MyCalendarEventsLocalTime' where we will add columns 'StartLocalTime' and 'EndLocalTime' to the MyCalendarEvents Collection
2. Use the local time to count the number of events on that day and also to display the details of these events on the right.
For the OnSelect property of the dropdownCalendarSelection2, we will use this formula -
/*retrieves calendar events for all days in current month view and selected calendar _minDate and _maxDate act as markers to prevent duplicate data collection*/ If(IsBlank(_userDomain), UpdateContext({_showLoading: true}); Set(_userDomain, Right(User().Email, Len(User().Email) - Find("@", User().Email))); Set(_dateSelected, Today()); Set(_firstDayOfMonth, DateAdd(Today(), 1 - Day(Today()), Days)); Set(_firstDayInView, DateAdd(_firstDayOfMonth, -(Weekday(_firstDayOfMonth) - 2 + 1), Days)); Set(_lastDayOfMonth, DateAdd(DateAdd(_firstDayOfMonth, 1, Months), -1, Days)) ); Set(_calendarVisible, false); UpdateContext({_showLoading: true}); Set(_myCalendar, dropdownCalendarSelection2.Selected); Set(_minDate, DateAdd(_firstDayOfMonth, -(Weekday(_firstDayOfMonth) - 2 + 1), Days)); Set(_maxDate, DateAdd(DateAdd(_firstDayOfMonth, -(Weekday(_firstDayOfMonth) - 2 + 1), Days), 40, Days)); ClearCollect(MyCalendarEventsNotLocal, Office365.GetEventsCalendarViewV2(_myCalendar.Name, Text(_minDate, UTC), Text(_maxDate, UTC)).value); ClearCollect(MyCalendarEventsLocalTime,AddColumns(MyCalendarEventsNotLocal,"StartTimeLocal", If(IsAllDay,DateAdd(Start,TimeZoneOffset(Start),Minutes),Start),"EndTimeLocal", If(IsAllDay,DateAdd(End,TimeZoneOffset(End),Minutes),End))); UpdateContext({_showLoading: false}); Set(_calendarVisible, true)
As you can see above I created two new columns and added the timezoneoffset minutes to the start and end time if it's an all day event (using the IsAllDay property ).
Now that we have the time in local time zone for the all day events as well - we can modify the formula for
1. the circle below the date - 'Circle2'
/*Visible if calendar events are found on this day*/CountRows( Filter( MyCalendarEventsLocalTime, DateValue(Text(StartTimeLocal)) = DateAdd( _firstDayInView, ThisItem.Value, Days ) ) ) > 0 && !Subcircle2.Visible && Title5.Visible
2. for Event details on the right -
Set the Gallery items to -
/*Shows events only on selected date*/ SortByColumns(Filter(MyCalendarEventsLocalTime, Text(StartTimeLocal, DateTimeFormat.ShortDate) = Text(_dateSelected, DateTimeFormat.ShortDate)), "Start")
For Description2 -
If(ThisItem.IsAllDay,"All Day", DateDiff(ThisItem.Start, ThisItem.End, Minutes) & Lower(Left("Minute", 1)))
and for Body2 -
Text(ThisItem.StartTimeLocal, DateTimeFormat.ShortTime)
Screenshot of how it looks after these changes -
Also, attaching the files for the powerapp file.
Hope this helps.
@Audrie-MSFT I guess this is either a bug on the connector of if it's supposed to be this way, the screen template needs to be modified.
Vivek Bavishi aka That API Guy
PowerApps and Flow MVP
Blog | Twitter | YouTube | Community Profile | GitHub
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Vivekb,
This works perfectly. Thanks so much. Looks like Audrie also commented that this should be fixed in the template.
Ed