Converting a Timestamp to UTC and daylight savings issues
When we need to get a UTC timestamp (for example creating a calendar .ics file) we would use the following code:
vars
utcPickupTime, pickupTime : TimeStamp;
begin
pickupTime.setDate("05/11/2018".Date);
pickupTime.setTime("10:30".Time);
utcPickupTime := pickupTime.localToUTCTimeUsingBias(app.currentUTCBias(PresentationClient));
The problem is app.currentUTCBias is working for the current point in time. Not working when the pickup time actually is.
In my investigation into this I found this is currently an NFS in Parsys: #55992, #56076
To get around this we are going to need to add an external call to windows which we shouldn't need to do if it was native in Jade.
HistoricalComments
FileVision UK Ltd 12/06/2018 2:36:50 AM Also #61379
Software Medical Infomatics Limited 11/06/2018 11:29:43 AM Most definitely!
|
Here is how you could write the above code using JadeTimeZone to get the appropriate offsets for when the pickup time is:
example_jadeTimeZoneCode();
vars
utcPickupTime, pickupTime : TimeStamp;
presClientTimeZone: JadeTimeZone;
begin
pickupTime.setDate("5/11/2018".Date);
pickupTime.setTime("10:30".Time);
presClientTimeZone := JadeTimeZone@createTimeZoneByLocationWindows(PresentationClient);
utcPickupTime := presClientTimeZone.convertTimeToUtc(pickupTime);
end;
JADE Timezones demo is available here.