Click to See Complete Forum and Search --> : Bug in World Clock Script


ohei
05-04-2004, 10:19 AM
Hi,

there seems the be a bug in the World Clock script available at http://javascript.internet.com/calendars/.

The time displayed can get negative. To overcome this problem of the great script, replace

var def = dt.getTimezoneOffset()/60;
var gmt = (dt.getHours() + def);

with

var def = dt.getTimezoneOffset()/60;
var gmtval = (dt.getHours() + def);
// check for negative value
var gmt = (gmtval < 0) ? (24 + gmtval) : gmtval;

Regards,
ohei

Juuitchan
05-04-2004, 04:06 PM
Can the value also be greater than or equal to 24?

ohei
05-18-2004, 02:46 PM
Yes, it can be greater than 24, but this is handled by the check24 function in the script.

Oliver