Timezone Aware

Use MomentJS to display a countdown accordingly to the selected timezone no matter the localtime your computer is.

Next year from timezone:

HTML:
<!-- Include MomentJS library -->
<script src="moment.js"></script>
<script src="moment-timezone-with-data.js"></script>

<div id="clock"></div>
JS:
var nextYear = moment.tz("2015-01-01 00:00", "America/Sao_Paulo");

$('#clock').countdown(nextYear.toDate(), function(event) {
  $(this).html(event.strftime('%D days %H:%M:%S'));
});

Feature read

Why use MomentJS

The JavaScript Date object has support for timezones, but by default are naive – does not have any information about the timezone – and are localized according to where is run:

The JavaScript Date object supports a number of UTC (universal) methods, as well as local time methods. UTC, also known as Greenwich Mean Time (GMT), refers to the time as set by the World Time Standard. The local time is the time known to the computer where JavaScript is executed.

– From: Mozilla Developer Network

MomentJS is a great piece of open-source project, is stable, well maintained and have a great support to manage and convert the timezone aware Date objects. Is good to remember that it’s a best practice to always store and retreive dates from the server in the UTC.

From the beginning, this project aimed to create an easy to use and customizable countdown plugin, people often have a hard time do disassociate the timezone problem from the former because they look the same but they are not.

Keep in mind that this project will NEVER support a timezone aware version out-of-the box.

Fork me on GitHub