Countdown timer is a jquery plugin which will render a Countdown widget in your app. Though this script executes on the client side, it will not have any issues with the users residing in different time zones.
You need to pass in the Current Time and the Countdown End Time. You need to pass in the Current time, to avoid any time zone inconsistencies.
jQuery("div").countdowntimer("October 25, 2012 11:13:00", "December 25, 2012 11:13:00")
jQuery("div").countdowntimer("October 25, 2012 11:13:00", "December 25, 2012 11:13:00", {
widgetTitle: "Countdown to Christmas",
WidgetEnd: "Happy Christmas"
});
- Current time - a valid dateString - October 13, 2012 11:13:00 or 2012-10-29 00:00:58
- Event End time - a valid dateString - November 13, 2012 11:13:00 or 2012-11-29 00:00:58
- widgetTitle - The title of the widget
- widgetEnd - The text which should be displayed when the countdown ends
In rails you can, pass in the current server time with Time.now
<%= javascript_tag do %>
jQuery("div").countdowntimer("<%= Time.now.utc %>", "December 25, 2012 00:00:00")
<% end %>
jQuery 1.4+