web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / V2CalendarPostItem to ...
Power Apps
Answered

V2CalendarPostItem to Outlook before and after DST change

(0) ShareShare
ReportReport
Posted on by

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.

Categories:
I have the same question (0)
  • Verified answer
    RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    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

  • Community Power Platform Member Profile Picture
    on at

    Thanks Randy. That's what I missed.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 711 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 319 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard