How do you force your flow to calculate the correct DST offset even if your SNow instance has its system configurations set to GMT?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2022 03:40 PM
Hello,
How do you force your flow in Flow Designer to calculate the correct daylight savings time offset to accommodate users who use Central time zone in their ServiceNow instance profile even if the ServiceNow instance's system configuration is set to GMT?
Background:
Up until March 13, 2022, our script within a flow to calculate the DST offset was working in Flow Designer. Then the daylight savings happened, and suddenly it stopped working and kept returning an offset of 0 when it should be returning 3600000.
We opened a ticket with ServiceNow support and their response was, it's behaving by design because the instance system config is set to GMT.
This is a sample of the script that used to work before March 13, 2022 and the previous year:
var gdt = new GlideDateTime("2022-03-21 18:05:00"); //Scheduled Time
var gtime5 = new GlideTime(); //Variable for DST
var gtime6 = new GlideTime(); //Variable for non-DST
var offset = gdt.getDSTOffset();
gs.info(offset);
//Check if time is during Daylight Savings Time, add +5 to the UTC time
if (offset !== 0) {
gtime5.setValue("05:00:00");
gdt.add(gtime5);
scheduled_time = gdt; //Scheduled Time
gs.info(scheduled_time);
gs.info("Pick IF statement");
} else {
//Otherwise, add +6 to the UTC time when not during Daylight Savings Time
gtime6.setValue("06:00:00");
gdt.add(gtime6);
scheduled_time = gdt;
gs.info(scheduled_time);
gs.info("Pick ELSE statement");
}
Actual and Expected correct output:
3600000
2022-03-21 23:05:00
Pick IF statement
So how do you force your flow to get around this and still be able to calculate the DST offset since users are in Central time zone?
We're looking for a workaround...any help would be greatly appreciated.
Thank you in advance for your time,
Harriet
- Labels:
-
flow designer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2022 04:05 PM
Could you share why do you need to calculate the offset?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2022 09:18 AM
Hello,
According to ServiceNow support, our instance's system settings is set to the default GMT so it's unable to detect time change due to Daylight Saving Time. I have a flow in Flow Designer that must show the time in Central time zone to the user front-end. This is why I need to calculate the offset.
Do you know how I can accomplish this?
Thanks,
Harriet
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2022 09:42 AM
I would also like to add that this issue is only seen when grabbing time from an external file (i.e. Excel spreadsheet). Which is why we really need this offset calculation to work.
Thanks,
Harriet
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2022 09:50 AM
ServiceNow show dates and times in the Time zone selected by a user for itself without any further configuration. If the system saved a data as GMT 16:00 and user has selected CDT as its preferred time zone, the system will display the very same value as (CDT) 11:00. Absolutely nothing needs to be done there.
Perhaps the real problem is with the import itself that miss-interprets those dates as being in a different time zone then intended. Can you elaborate on how the import is configured?