cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Elgin
Level: Powered On

V2CalendarPostItem to Outlook before and after DST change

For a calendar item created in PowerApps, the date offset in Outlook 365 is different before and after Daylight Savings Time change. In this case, DST is March 10, 2019.

 

For testing, I create two leave requests, both 8:30 AM – 5:00 PM. One is created before the time change. The other is created after the time change.

 

If the user requests the day off on the Friday 3/8/2019 (BEFORE DST), the resulting event is correct: 8:30 AM – 5:00 PM.

If the user requests the day off on the Monday 3/11/2019 (AFTER DST), the resulting event is wrong: 7:30 AM – 4:00 PM.

 

EditLeaveStart and EditLeaveEnd are text values created from a combination of Date Picker and a text field.

Here’s the code that creates the Outlook calendar entry:

 

/*create start and end datetimes*/

Set(EditLeaveStart, DateTimeValue(NRSelectDatesFromDatePicker & " " & NRDropdownHoursFrom.Selected.Value));

Set(EditLeaveEnd, DateTimeValue(NRSelectDatesToDatePicker & " " & NRDropdownHoursTo.Selected.Value));

 

/*write to calendar*/  

    Office365.V2CalendarPostItem(

        SFICalendarID,

        Text("Pending ") & ThisLeaveType & Text(" request for ") & Office365Users.UserProfile(MyProfile.Id).DisplayName,

        DateAdd(EditLeaveStart, -TimeZoneOffset(),Minutes),

        DateAdd(EditLeaveEnd, -TimeZoneOffset(),Minutes),

        {

            Body: "Hours requested: " & EditRequestHours,

            TimeZone: "Eastern Standard Time",

            IsHtml: true,

            Location: ThisCalID,

            IsAllDay: false,

            Reminder:0

        }

    );

 

Resulting appointments in the attachments:

Created before the time change.

Created after the time change.

 

Any help would be appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: V2CalendarPostItem to Outlook before and after DST change

Do you need the TimeZoneOffset?

We use the calendar posting and don't use it, just a straight date/time.

 

However, if you do need it, then I believe your issue is that you are not telling the TimeZoneOffset what the date is for the TimeZoneOffset.

TimeZoneOffset without the optional "Date" parameter will return the offset for the current date.

So, I believe, in this case, you would want to put the start and end dates in the parameter for the function:

 

        DateAdd(EditLeaveStart, -TimeZoneOffset(EditLeaveStart),Minutes),

        DateAdd(EditLeaveEnd, -TimeZoneOffset(EditLeaveEnd),Minutes)

 

Hope that helps

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

View solution in original post

2 REPLIES 2
Super User
Super User

Re: V2CalendarPostItem to Outlook before and after DST change

Do you need the TimeZoneOffset?

We use the calendar posting and don't use it, just a straight date/time.

 

However, if you do need it, then I believe your issue is that you are not telling the TimeZoneOffset what the date is for the TimeZoneOffset.

TimeZoneOffset without the optional "Date" parameter will return the offset for the current date.

So, I believe, in this case, you would want to put the start and end dates in the parameter for the function:

 

        DateAdd(EditLeaveStart, -TimeZoneOffset(EditLeaveStart),Minutes),

        DateAdd(EditLeaveEnd, -TimeZoneOffset(EditLeaveEnd),Minutes)

 

Hope that helps

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

View solution in original post

Elgin
Level: Powered On

Re: V2CalendarPostItem to Outlook before and after DST change

Thanks Randy. That's what I missed.

Helpful resources

Announcements
thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (4,870)