Support » Plugin: jQuery T(-) Countdown Widget » Can I pass timezone to shortcode?

  • Resolved RachieVee

    (@rachievee)


    Hi,

    I am currently using this count down plugin, which works as expected, but I had a question regarding timezones when passing parameters to the shortcode.

    I’m using this plugin to count down to a date when events start (a custom post type), which uses a date that is saved to the WP post. This is what I’d normally pass as the date for the shortcode to count down to.

    However, I need to be able to countdown to a date that’s in a different timezone than what I assume is UTC by default? Can I pass in a date object that includes timezone or is the shortcode limited to a format string?

    Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor twinpictures

    (@twinpictures)

    Hello.

    The Timezone that the plugin uses is the same general timezone setting that has been defined for WordPress under:
    Dashboard > Settings > General > Timezone

    If a city is selected (rather than an UTC +/- value) automatic adjustments will be made for standard/daylight savings time.

    If the target time is not in the WordPress Timezone, then the inserted time value should be shifted to match local time. Or put simply, use the time that the event will take place in the WP Timezone.

    Example: The Falcom Heavy Space-X Launch was on February 6, 2018, at 3:45 p.m. EST (or 20:45 UTC) But is the WordPress us using a Berlin Timezone (UTC +1), then the ‘launch’ date and time would be:
    t="2018-02-06 21:45:00"

    Hope that helps.

    Plugin Contributor twinpictures

    (@twinpictures)

    …of course… it would be easy to add the ability to pass in a target UTC offset. Pull requests are always welcomed, and we do have an upcoming update anyway…

    Ok thanks! I’ll see if I can work on converting the time to the WordPress timezone.

    Plugin Contributor twinpictures

    (@twinpictures)

    Hit us back if you have issues… we are happy to help.

    Plugin Contributor twinpictures

    (@twinpictures)

    update: we added a new timezone attribute to the next release, currently available on GitHub. This new attribute accepts a php DateTimeZone value like so:

    [tminus t="2018-02-06 15:45:00" timezone="America/New_York"/]
    

    Since the ‘now’ time is still calculated based on the WordPress timezone setting, this would be the same as using:

    [tminus t="2018-02-06 21:45:00"/]
    

    If the server was setup in a Berlin Timezone

    Issue marked as resolved.

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.