I am using this CountDown Plugin, here is my code and view:
<div class="sc" lang="2013, 12 -1, 18">
<div class="sc" lang="2013, 6 -1, 22">
<script>
$(document).ready(function(){
$(".sc").each(function(){
$(this).countdown({until: $(this).attr("lang"), compact: true, format: 'HMS', description: ''});});});
</script>
My problem is it returns wrong time, example: 00:34:00 and the other is 00:34:03.
Could anyone help me?
I’m trying to learn English, so i speak English not well, so sorry.
You are using the until parameter incorrectly, you need a new Date object there and your current lang attr cannot be parsed into that.
EDIT: Since your target date is so far away it would be better if you used
ODHMSorDHMSas your format to include months and days as needed.I have made some changes to your code to make it work.
HTML:
JQuery:
Also check a working sample in this fiddle: http://jsfiddle.net/EkmsT/
EDIT 2 : I have changed the lang values to 11 and 5 instead of 12-1 and 6-1 and used it directly in the countdown code as targetDate[1].trim(). You can still use 12 -1 and 6 -1 and change the new Date code to use parseInt(targetDate[1].trim())