html - How to add timezone to jQuery Countdown -


i using countdown found, countdown start of livestream, counting down time of pc, whereas want countdown bst (25th august @ 9am) (uk time).

here html code, believe need:

<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head>     <link rel="stylesheet" href="style.css" type="text/css" charset="utf-8" />     <link rel="stylesheet" href="ie.css" type="text/css" charset="utf-8" />     <script language="javascript" type="text/javascript" src="js/jquery-1.4.4.js"></script>     <script language="javascript" type="text/javascript" src="js/jquery.lwtcountdown-1.0.js"></script>     <script language="javascript" type="text/javascript" src="js/misc.js"></script> </head> <body>     <div id="countdown">         <div class="dash weeks_dash">             <span class="dash_title">weeks</span>             <div class="digit">0</div>             <div class="digit">0</div>         </div>         <div class="dash days_dash">             <span class="dash_title">days</span>             <div class="digit">0</div>             <div class="digit">0</div>         </div>         <div class="dash hours_dash">             <span class="dash_title">hours</span>             <div class="digit">0</div>             <div class="digit">0</div>         </div>         <div class="dash minutes_dash">             <span class="dash_title">minutes</span>             <div class="digit">0</div>             <div class="digit">0</div>         </div>         <div class="dash seconds_dash">             <span class="dash_title">seconds</span>             <div class="digit">0</div>             <div class="digit">0</div>         </div>     </div> <!-- end of countdown -->     <!-- start of javascript code handles countdown -->     <script language="javascript" type="text/javascript">         jquery(document).ready(function() {             $('#countdown').countdown({                 targetdate: {                     'day':      25,                     'month':    8,                     'year':     2013,                     'hour':     9,                     'min':      0,                     'sec':      0                 }             });         });     </script>     <!-- end of javascript code handles countdown --> </body> 

i assume mean this component. next time, please provide link don't have search.

first determine utc time event. there many ways that, won't address them here unless issue.

the utc time example gave 2013-08-05 8:00:00.

in docs here show how pass time in utc:

jquery(document).ready(function() {     $('#countdown').countdown({         targetdate: {             'day':      25,             'month':    8,             'year':     2013,             'hour':     8,        // note input time in utc             'min':      0,             'sec':      0,             'utc':      true      // set parameter true             }         });     }); 

digging source of component itself, in jquery.lwtcountdown-1.0.js, there bug in code:

if (options.targetdate) {     targettime = new date(options.targetdate.month + '/' + options.targetdate.day + '/' + options.targetdate.year + ' ' + options.targetdate.hour + ':' + options.targetdate.min + ':' + options.targetdate.sec + (options.targetdate.utc ? ' utc' : '')); } 

they creating date assembling date string hard-coded in mm/dd/yyyy format. not work in places use other date formats, such dd/mm/yyyy format used in uk. should instead passing separate parameters. change code this:

if (options.targetdate) {   var td = options.targetdate;   if (options.targetdate.utc)     targettime = new date(date.utc(td.year, td.month-1, td.day, td.hour, td.min, td.sec));   else     targettime = new date(td.year, td.month-1, td.day, td.hour, td.min, td.sec); } 

you should report bug author.


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -