cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Kudo Kingpin
Kudo Kingpin

Datetime switching regions depending on browser - so frustrating!

Hi,

 

So I'm putting calendar entries in from a PowerApp by calling V4CalendarPostItem. My start and end dates are passed in with a variable which I preset as below:-

 

Set(EventStart, Text(Text(ThisItem.EventStart), "[$-en-GB]dd/mm/yyyy hh:mm"))

 

I also set the region in the appropriate place the v4 calendar command expects, as below:-

 

"(UTC+00:00) Dublin, Edinburgh, Lisbon, London"

 

Now you - much like Google Chrome - might notice that I'm going for a UK date format! Unfortunately IE and Firefox put the events in mm/dd instead of dd/mm.

 

As far as I can tell, V2CalendarPostItem doesn't suffer this flaw.

 

I would really appreciate some help with getting this to work!

8 REPLIES 8
Highlighted
Community Support
Community Support

Re: Datetime switching regions depending on browser - so frustrating!

Hi @davidstone:

Could you tell me what ThisItem.EventStart”‘s data type is? Date time? Text?

I assume ThisItem.EventStart”‘s data type is Date time.

Firstly, let me explain why this formula does not work.

Set(EventStart, Text(Text(ThisItem.EventStart), "[$-en-GB]dd/mm/yyyy hh:mm"))

The part I have marked(Text(ThisItem.EventStart)) is a string. But Text(NumberOrDateTimeCustomFormat [, ResultLanguageTag ]) only effect on number or data time.

I think this link will help you a lot:

Text function in Power Apps:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-text

Finally, I suggest you try this code:

Set(EventStart, Text(ThisItem.EventStart, "[$-en-GB]dd/mm/yyyy hh:mm"))

Or

Set(EventStart, DateTimeValue (Text(ThisItem.EventStart), "en-GB"))

Best Regards,

Bof

Highlighted
Kudo Kingpin
Kudo Kingpin

Re: Datetime switching regions depending on browser - so frustrating!

Hi Bof,

 

You picked out the same thing I did when I pasted my code in - that it looks odd to have a nested Text function. The reason relates to the answer to your other question about the ThisItem.EeventStart, which is a SharePoint date-time column. Unless I convert that to text first, I get an error.

 

I will try both of your suggestions below and report back...

Highlighted
Kudo Kingpin
Kudo Kingpin

Re: Datetime switching regions depending on browser - so frustrating!

So, no difference.

 

Interestingly, I can display the variable once it's set and it show as the correct date in all browsers. Nevertheless, the V4CalendarPostItem function reinterprets the date passed into it depending on the browser used.

Highlighted
Kudo Kingpin
Kudo Kingpin

Re: Datetime switching regions depending on browser - so frustrating!

Here's my code for V4CalendarPostItem:-

 

Office365Outlook.V4CalendarPostItem(Hidden_CalendarSelector.SelectedText.Value,
ThisItem.Title,
EventStart,
EventFinish,
"(UTC+00:00) Dublin, Edinburgh, Lisbon, London",
{body:Temp_invite,
location:ThisItem.LocationDetail,
importance:"Normal",
reminderMinutesBeforeStart:ThisItem.CalReminderTime,
responseRequested:false,
showAs:ThisItem.CalendarBusyFree})

 

I've even tried specifying a format inside of the function by wrapping my start and end variables in a Text function as below:-

 

Office365Outlook.V4CalendarPostItem(Hidden_CalendarSelector.SelectedText.Value,
ThisItem.Title,
Text(EventStart), "en-GB"),
Text(EventFinish), "en-GB"),
"(UTC+00:00) Dublin, Edinburgh, Lisbon, London",
{body:Temp_invite,
location:ThisItem.LocationDetail,
importance:"Normal",
reminderMinutesBeforeStart:ThisItem.CalReminderTime,
responseRequested:false,
showAs:ThisItem.CalendarBusyFree})

 

I can't see any way to code around this.

Highlighted
Community Support
Community Support

Re: Datetime switching regions depending on browser - so frustrating!

Hi @davidstone :

Have you encountered the problem that shown in this picture?
 
 
1.PNG
 
If so,I think this link will help you a lot.
Best Regards,
Bof
Highlighted
Kudo Kingpin
Kudo Kingpin

Re: Datetime switching regions depending on browser - so frustrating!

Hi Bof, it's not that issue. I've raised a second post because I'm now confident there is definitely a bug having thoroughly tested v2 and v4 across browsers yet using the same exact dates.

Highlighted
Community Support
Community Support

Re: Datetime switching regions depending on browser - so frustrating!

Hi @davidstone

Maybe you can try this solution——

Change your computer's system settings:

-Settings-Time&Language-Language-Preferred languages-Add a preferred language-select "English(united Kingdom)"-

select "Set as my display language"

1.png

Best Regards,

Bof

Highlighted
Kudo Kingpin
Kudo Kingpin

Re: Datetime switching regions depending on browser - so frustrating!

That's already my default. Plus I've got almost 2000 users and wouldn't want to try and get them all to change system settings.

 

Have you seen my updated post?

 

https://powerusers.microsoft.com/t5/Building-Power-Apps/Confirmed-bug-with-V4CalendarPostItems/m-p/5...

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (7,380)