I have two values. one a [STRING] and one an [INT] TimeZone is a string of one of these values:
'EST-5:00' || 'CST-6:00' || 'MST-7:00' || 'PST-8:00'
DST will be an INT of 0 || 1.
Trying to figure out how best to get offset. offset = MATH.abs(TimeZone# + DST) ie.
let offset = MATH.abs(-5 + 1) // = 4 ('EST-5:00') + (DST = 1)
or
let offset = MATH.abs(-6 + 0) // = 6 ('CST-6:00') + (DST = 0)
or
let offset = MATH.abs(-8 + 1) // = 7 ('PST-8:00') + (DST = 1)
What is the best way to parse the string to get the number value and add the value of DST?
My end goal is actually to get a DateTime I have such as:
let DateTime = '2017-05-11 10:34:43'
along with the TimeZone String above (retrieved from metadata related to the event) and transform it to UTC using the DST Int (retrieved from metadata related to the event) ...
So I am trying to find out how much I need to add (hours) to the DateTime to set it to UTC given the data I have to work with.
so
let utcTime = moment(DateTime).add(offset, 'h');
matchmethod ofString