S tag for time zone?

Options
By any chance, is there an S tag or an equivalent merge tag that relates to a supporter's time zone? I would like to use a clock that counts down to midnight local time. The service I am using to render this clock says that a time zone merge tag could be appended to the image path to do this. All advice is welcome!


Thanks very much,

Gaby Gollub

World Wildlife Fund
Tagged:

Comments

  • There is a Google Time Zone API if you have no luck with S-Tags.


    https://developers.google.com/maps/documentation/timezone/intro#Requests

     
  • Gaby Gollub:

    [...] I would like to use a clock that counts down to midnight local time. [...]

    The widget you're using for this countdown timer, does it explicitly ask you for a timezone? Assuming it's written in JavaScript, if a Date object is created without regard to timezone, it will always use the client's (aka the viewer's) local time. If you're unsure, I'd say put the widget on a page and check the countdown time, then change your timezone on your machine and see if the countdown adjusts accordingly. If it does, then it's using default JavaScript behavior and you're already good to go.

    If not, you can set the countdown timer using UTC time, use getTimeZoneOffset() to get the client's timezone, then adjust accordingly (since getTimeZoneOffset() returns the clients time in hours' difference from UTC).

  • Nice, Mark. Thinking about the problem and not just the question.
  • Thanks, Brian and Mark. This is all very interesting to me!


    To clarify, what I'm using is a third-party tool that generates a countdown clock rendered as an image, and I am using it in an email. My understanding is that, to modify the time according to someone's time zone, my options would be: adding a time-zone merge tag to the image path (not an option thru LO), or creating multiple countdowns and using conditionals to show the appropriate one to supporters, based on their state. It sounds like an option similar to what you described would be something completely different, which is a possibility.


    I was curious if anyone has done anything like this in an email with a deadline, like a giving day or December 31. Anyone?


    Thanks much,

    Gaby
  • Ah, if it's in an email, the JavaScript solution is right out -- no email client will execute arbitrary script, too much of a security risk.

    The conditional with multiple countdowns is probably the easiest way to go, if not involving the least amount of typing. By state would work in most cases, but some states are split across zones -- see http://www.nationsonline.org/maps/US-timezones.jpg for reference. The best way I can see to do that would be to conditionalize on state, and then if it matches one of the split states (Oregon, Idaho, Arizona, North Dakota, South Dakota, Nebraska, Kansas, Texas, Michigan, Indiana, Kentucky, Tennessee, Florida... and maybe Alaska, if you have any constituents far out on the Aleutians), it can check to see what county the constituent is in. Like, in Oregon, Malheur county is the only county in Mountain time instead of Pacific, so I'd conditionalize on whether or not the person lived in Malheur. Wikipedia seems to be a good source for county-by-county timezones in a state, just look up Wiki pages with URLs in the form of https://en.wikipedia.org/wiki/Time_in_, e.g. https://en.wikipedia.org/wiki/Time_in_Oregon.

    For the images themselves, I would probably create an image file for each time zone, then overwrite those files each day/hour/minute (however frequently you want the timer to update) with newly-generated images, so that if someone opens up the email at one point and then again later, the time in the image will be updated accordingly.

  • If you are doing this sort of thing frequently, maybe do all that work in a Query and build time zone groups. Then your email can conditionalize on that group membership.

Categories