pfarmer/jquery-countdown

Countdown Date Start

Closed this issue · 5 comments

Hello,

I've tried the jquery-countdown and its working well, very nice script.

But I found something, that maybe you can help me to solve.

When we use an end Date, the script is counting in the begining of the current month until the date that you choose.

Example:

function do_counter() {
var _date = new Date();
_date.setMonth(1);
_date.setDate(22);
_date.setHours(13);
_date.setMinutes(54);
_date.setSeconds(0);
..........
};
The count should be 117 days and its appearing 147 days, because its counting: September, October, November, December, January 22th.

The correct way would be: September (only 27, 28 and 29th), October (Full Month), November (Full Month), December (Full Month), January until 22th.

Can you help me?

thanks!!

Hi,

January is actually month 0 not month 1.

http://www.w3schools.com/jsref/jsref_setmonth.asp

So the your code should in fact be:

function do_counter() {
var _date = new Date();
_date.setMonth(0);
_date.setDate(22);
_date.setHours(13);
_date.setMinutes(54);
_date.setSeconds(0);
..........
};

I'll update the documentation to point this out.

Let me know if this doesn't fix your issue.

Thanks,

Peter

Nice!

It worked perfectly!

thanks Peter, and congrats for the script!

No worries, if your site is public, please add it to the wiki.

Hi Peter,

Look how it is: http://www.ofertasdibuteco.com.br/brevecount.html

I think that is having a little problem at the "animation" on the numbers flip

Its looks absolutely fine to me.