PCFControls icon indicating copy to clipboard operation
PCFControls copied to clipboard

Times in UTC?

Open jasa88 opened this issue 2 years ago • 7 comments

I've just installed the calendar on a model driven app I've developed and it's solved so many issues I've been having which is awesome, the only problem is that my event start times and date times are in UTC, and the calendar keeps trying to compensate for British Summer Time which is UTC +1. Is there any way of forcing the calendar to use UTC time?

jasa88 avatar May 08 '22 19:05 jasa88

The calendar uses the time in the data it is populated with. The calendar doesn't do timezone conversions. If the data is coming from CRM, it would depend on the type of date/time field you have specified as to what datetime you get back. Most likely the datetime is being converted to the user's timezone from UTC.

Art

On Sun, May 8, 2022 at 12:27 PM jasa88 @.***> wrote:

I've just installed the calendar on a model driven app I've developed and it's solved so many issues I've been having which is awesome, the only problem is that my event start times and date times are in UTC, and the calendar keeps trying to compensate for British Summer Time which is UTC +1. Is there any way of forcing the calendar to use UTC time?

— Reply to this email directly, view it on GitHub https://github.com/rwilson504/PCFControls/issues/235, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGEB6ISVOHRGGJXE335WPZ3VJAIRRANCNFSM5VMK7A7Q . You are receiving this because you are subscribed to this thread.Message ID: @.***>

ArtKarp avatar May 10 '22 18:05 ArtKarp

Hi Art,

That's really weird, because when I put the Calendar Control V2 view on, it displays the events in UTC, but when I do the rbc view it displays them in BST, so to me that's rbc converting the time?

jasa88 avatar May 11 '22 12:05 jasa88

Hi,

  • What is "RBC view"?

  • What is the configuration for the Date/Time fields you are using ( e.b. DataType, Behavior, Format?

For a CDS Date/time field that you want saved as the user entered and never converted by CDS/CRM the field needs to be set as: Data Type: Date and Time Field Type: Simple Behavior: Time-zone Independent (Note: If it isn't set to TZI then CRM will save the date time as UTC and convert it from UTC when the record is viewed based on the CDS user's time zone. You can test this by changing the user time zone to something different...say, US Pacific time which is -7 UTC currently. ) Format: Date and Time

I hope this helps,

-Art

On Wed, May 11, 2022 at 5:28 AM jasa88 @.***> wrote:

Hi Art,

That's really weird, because when I put the Calendar Control V2 view on, it displays the events in UTC, but when I do the rbc view it displays them in BST, so to me that's rbc converting the time?

— Reply to this email directly, view it on GitHub https://github.com/rwilson504/PCFControls/issues/235#issuecomment-1123694076, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGEB6IVFGEYC6SJAEFBYL4TVJORWXANCNFSM5VMK7A7Q . You are receiving this because you commented.Message ID: @.***>

ArtKarp avatar May 12 '22 00:05 ArtKarp

Hi Art,

Apologies, rbc = React Big Calendar. It's a model driven app I'm using and so I've created 2 different views, one using Calendar Control V2 and one using React Big Calendar.

For the date and time field, I have the following options set:

Type: Date and time Field type: Simple State: Unmanaged Field security: Disabled Audit status: Enabled Customizable: True Behaviour: Time Zone independant

Screen shots below of settings and what everything looks like:

Screenshot 2022-05-12 at 10 32 56 Screenshot 2022-05-12 at 10 33 24 Screenshot 2022-05-12 at 10 33 41 Screenshot 2022-05-12 at 10 33 56

jasa88 avatar May 12 '22 09:05 jasa88

Could you please try changing the logged in users time zone to something a number of hours away from UTC? Then see what the date/time results show in both calendars. This is a very odd issue.

-Art

On Thu, May 12, 2022 at 2:35 AM jasa88 @.***> wrote:

Hi Art,

Apologies, rbc = React Big Calendar. It's a model driven app I'm using and so I've created 2 different views, one using Calendar Control V2 and one using React Big Calendar.

For the date and time field, I have the following options set:

Type: Date and time Field type: Simple State: Unmanaged Field security: Disabled Audit status: Enabled Customizable: True Behaviour: Time Zone independant

Screen shots below of settings and what everything looks like:

[image: Screenshot 2022-05-12 at 10 32 56] https://user-images.githubusercontent.com/76397898/168040324-5e7fb5e4-70af-40ce-92fc-e544d05f4fa2.png

[image: Screenshot 2022-05-12 at 10 33 24] https://user-images.githubusercontent.com/76397898/168040336-7521523c-bbf3-4f3a-8879-9b13c031d4c1.png

[image: Screenshot 2022-05-12 at 10 33 41] https://user-images.githubusercontent.com/76397898/168040339-fa2cf039-d750-444e-a59b-bc65dad71d7c.png

[image: Screenshot 2022-05-12 at 10 33 56] https://user-images.githubusercontent.com/76397898/168040342-a1a42ee6-4889-4c0b-b39f-b3588f688b72.png

— Reply to this email directly, view it on GitHub https://github.com/rwilson504/PCFControls/issues/235#issuecomment-1124755198, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGEB6IQJ5GZPHWMTHTHCU6LVJTGFDANCNFSM5VMK7A7Q . You are receiving this because you commented.Message ID: @.***>

ArtKarp avatar May 17 '22 04:05 ArtKarp

I just set my user time to Canada (-4 UTC) and nothing moved on the app itself, the Calendar Control V2 view stayed in UTC, and the rbc Calendar view stayed in BST.

However, just to satisfy my curiosity I downloaded a Chrome extension to change the timezone of my browser, Calendar control V2 again stayed where it was, but everything on the rbc view moved relative to the updated timezone(!!) It appears that react big calendar somehow uses my browser locale to know what timezone it should be displaying things in relative to UTC. I can't really ask all the users of the app to download a Chrome extension to change their timezone as god knows what bugs that would introduce, but is there a way of telling react big calendar what timezone to use and ignore the browser locale?

jasa88 avatar May 17 '22 17:05 jasa88

Hi,

I don't know anything about RBC. I only have created Canvas apps using the Calendar control that Rick created. So it looks like the CDS data returned within the model app is all correct. In displaying the data, I would suggest that you add something to indicate the time zone so everyone is clear which time zone is being used. In person events are set by their physical location. If you have a virtual event, you would need to also select a time zone too.

Hope this has been helpful,

-Art

On Tue, May 17, 2022 at 10:31 AM jasa88 @.***> wrote:

I just set my user time to Canada (-4 UTC) and nothing moved on the app itself, the Calendar Control V2 view stayed in UTC, and the rbc Calendar view stayed in BST.

However, just to satisfy my curiosity I downloaded a Chrome extension to change the timezone of my browser, Calendar control V2 again stayed where it was, but everything on the rbc view moved relative to the updated timezone(!!) It appears that react big calendar somehow uses my browser locale to know what timezone it should be displaying things in relative to UTC. I can't really ask all the users of the app to download a Chrome extension to change their timezone as god knows what bugs that would introduce, but is there a way of telling react big calendar what timezone to use and ignore the browser locale?

— Reply to this email directly, view it on GitHub https://github.com/rwilson504/PCFControls/issues/235#issuecomment-1129134662, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGEB6IT2TMVSJDI6YPOSHETVKPJYVANCNFSM5VMK7A7Q . You are receiving this because you commented.Message ID: @.***>

ArtKarp avatar May 17 '22 22:05 ArtKarp