I am using FlipClock.js to have a countdown clock till new year day. I want to change this to countdown to 8am local time on the first. I am a bit confused as to how to do this.
Here is the script I am currently using:
var clock;
$(function() {
var currentDate = new Date();
var futureDate = new Date(currentDate.getFullYear() + 1, 0, 1);
var diff = futureDate.getTime() / 1000 - currentDate.getTime() / 1000;
clock = $('.clock').FlipClock(diff, {
clockFace: 'DailyCounter',
countdown: true
});
});
EDIT
I tried changing my code to this:
var clock;
$(function() {
var currentDate = new Date();
var futureDate = new Date(Date.UTC(2014, 0, 01, 08, 0, 0));
var diff = futureDate.getTime() / 1000 - currentDate.getTime() / 1000;
clock = $('.clock').FlipClock(diff, {
clockFace: 'DailyCounter',
countdown: true
});
});
This line
var futureDate = new Date(currentDate.getFullYear() + 1, 0, 1);
was changed to this line:
var futureDate = new Date(Date.UTC(2014, 0, 01, 08, 0, 0));
When I did this it added one hour to the countdown clock. It should of added more since the time was 12am to 8am. What did I do wrong and how do I correct it?