hilios / jQuery.countdown

The Final Countdown plugin for jQuery
http://hilios.github.io/jQuery.countdown/
MIT License
2.31k stars 718 forks source link

hours issue on same date #214

Open ashrafxcoder opened 8 years ago

ashrafxcoder commented 8 years ago

It doesn't work for me when the date is the same but just hours are different

hilios commented 8 years ago

Please, provide a JSFiddle for proper feedback

ashrafxcoder commented 8 years ago

This is the snapshot that i wrote in c#. jsfiddle

hilios commented 8 years ago

What's the expected output? By analyzing you code the output will be 24:00:00?

Take a time to notice that the event.offset.hours should return the hours left to the next day.

Fortunately the version 2.2.0 we introduced the totalHours - %I directive, that I believe is just the case you are searching:

$(this).text(event.strftime("%I:%M:%S"));

If you just want to fix your code, just correct the math of the var totalHours = ...

ashrafxcoder commented 8 years ago

Final Time: 2016/08/08 11:21:05 Current TIme: 2016/08/08 08:21:05 See the difference is only in the hours. This shows 00:00:00 in the countdown div

ashrafxcoder commented 8 years ago

But when I add a day to the final date then the countdown starts

hilios commented 8 years ago

https://jsfiddle.net/

MrTambourineSLO commented 8 years ago

I was pulling my hair with similar problem you have. My advice MAKE SURE that month is correct. I was using Moment.js to calculate dates and it's getMonth() method was zero based thus when I concatenated the strings together to a date it was for previous month so I had to add 1 to (a zero based) month returned from current date.

ashrafxcoder commented 8 years ago

Yeah I had the same issue and i solved it by then.... Anyway thanks for posting as i it might help someone...

Ashraf Ali

On Oct 14, 2016, at 2:54 AM, Sašo Miocinovic notifications@github.com wrote:

I was pulling my hair with similar problem you have. My advice MAKE SURE that month is correct. I was using Moment.js to calculate dates and it's getMonth() method was zero based thus when I concatenated the strings together to a date it was for previous month so I had to add 1 to (a zero based) month returned from current date.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.