
Glitch IE with date difference calculation, Javascript
Hello!
Made a simple countdown counter on js (code below).
It was accidentally discovered that in different browsers the counting numbers are different.
Through simple checks it turned out:
1) count ('31 ',' Oct ',' 2010 ') returns 192 days everywhere (data from April 21, 2010).
2) count ('01 ',' Nov ',' 2010 ') returns 193 days everywhere, except IE, in which the result is 194.
Moreover, in the future the result is aligned. That is:
1) count ('27 ',' Mar ',' 2011 ') - everywhere 339, in IE - 340.
2) count ('28', 'Mar', '2011') - everywhere 340 ( including IE).
PS IE 8.0, compared with Opera, Firefox and Chrome.
Counter Code:
Made a simple countdown counter on js (code below).
It was accidentally discovered that in different browsers the counting numbers are different.
Through simple checks it turned out:
1) count ('31 ',' Oct ',' 2010 ') returns 192 days everywhere (data from April 21, 2010).
2) count ('01 ',' Nov ',' 2010 ') returns 193 days everywhere, except IE, in which the result is 194.
Moreover, in the future the result is aligned. That is:
1) count ('27 ',' Mar ',' 2011 ') - everywhere 339, in IE - 340.
2) count ('28', 'Mar', '2011') - everywhere 340 ( including IE).
PS IE 8.0, compared with Opera, Firefox and Chrome.
Counter Code:
function count(dt,mt,yr){
theDate = mt + ' ' + dt + ' ' + yr;
now = new Date();
setdate = new Date(theDate);
timer = (setdate - now) / 1000 / 60 / 60 / 24;
timer = Math.round(timer);
return timer
}