Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.

getTime() conditional statement javascript

Avatar

Former Community Member

I made a time zone converter that ignores daylight savings time. Now I am trying to include DST and am a little lost. I am thinking a conditional statement in my variables that says something along the lines of:

if(date is between march xx and nov xx){

use these utc offsets

}else{

use dst utc offsets

}

I have two arrays, one for the time zone/country and another for the UTC offset shown here to populate my combo boxes:

arrays.JPG

Then a function:

fun.JPG

I then have 2 more arrays that only differ in UTC offsets and a function that only differs in the variable names. Would the psuedo code I wrote before work or are there any better methods? I could also take user input as a radio button I thought too. Secondly I thought maybe I could start the if statement just outside the array for UTC Offsets. Any thoughts?

0 Replies