...

View Full Version : a weird bug in PC's clock



Kor
12-15-2006, 08:33 AM
If your PC (on Windows) internal clock is set, in Time Zone, for "Automatically adjust clock for daylight saving changes", try this:


<script type="text/javascript">
alert(new Date(2007,02,25))
</script>


Yes, it adjusts the time according to the DST, but (at least in my country is so), on the last Saturday/Sunday night of the March, the 01:00 hours Sunday becomes 00:00 hours Sunday.

But the PC clock turns 00:00 hours Sunday into 23:00 Saturday, which looks weird to me.

The problem will interfere with a common javascript application, the calendar. I am building one of them right now, and (as I am not interested in hours for the calendar) the quick workaround was to add an hour in my function which checks the lenght of the month:


...
/* Validates for month's last date */
function checkDate(d,j){
var nextDay= new Date(d.Y,d.M,j,01);//HH=01 - correction for DST
return nextDay.getDate()!=j||nextDay.getMonth()!=d.objM||nextDay.getFullYear()!=d.Y?false:true;
}
...

So, the problem looks solved, even in a dirty way, but, anyway, it remains a weird behaviour for me... is this a bug of the computer's timer, or what?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum