Date Validation for 3 Dropdowns!?

D

Dr John Stockton

JRS: In article <[email protected]>, dated Tue,
26 Apr 2005 23:27:39, seen in Mick White
I have some trouble with your site using Safari. The date
object is, well, different.

AIUI, Safari is at least moderately often used, though I know nothing of
it myself, not even what it runs on. In that case, let's investigate :
for example, how does it differ from ECMA-262, what on my site does not
work, etc.? Can feature detection help? What should the FAQ say? Is
there a Safari FAQ? a Safari javascript FAQ? a Safari javascript date
FAQ?
 
M

Mick White

Dr said:
JRS: In article <[email protected]>, dated Tue,
26 Apr 2005 23:27:39, seen in Mick White



AIUI, Safari is at least moderately often used, though I know nothing of
it myself, not even what it runs on. In that case, let's investigate :
for example, how does it differ from ECMA-262, what on my site does not
work, etc.? Can feature detection help? What should the FAQ say? Is
there a Safari FAQ? a Safari javascript FAQ? a Safari javascript date
FAQ?
Safari will render only dates from ~1900 to ~2035.
And it had trouble with "setting" the date

function getWeekday(year,weekday){
var weekdays=new Array();
var starter=getNthDayInMonth(1,weekday,"January",year);
//1st monday of year

var D=new Date("January "+starter+", "+year).getTime()
for(var t=D;t<D+52*6048e5;t+=6048e5){
weekdays[weekdays.length]=new Date(t);
}
return weekdays;
}

In the loop, you'd think the following would work, but no.

for(var t=0;t<52*7;t+=7){
weekdays[weekdays.length]=D.setDate(t);
}

Likewise:
var t=0,Y=D.getFullYear(),NY=D+1;
while(year<NY){
t+=7;
weekdays[weekdays.length]=D.setDate(t)
}
Mick



while(year <+1
 
M

Mick White

Mick said:
Dr John Stockton wrote: [snip]

var D=new Date("January "+starter+", "+year).getTime(); [snip]
var t=0,Y=D.getFullYear(),NY=D+1;
while(year<NY){
t+=7;
weekdays[weekdays.length]=D.setDate(t)
}
Mick

Forget the while clause , D is, of course, a timestamp, not a date object.

Mick
 
D

Dr John Stockton

JRS: In article <[email protected]>, dated Thu,
28 Apr 2005 12:06:35, seen in Mick White
Safari will render only dates from ~1900 to ~2035.

All Safari, or just some versions?

My js-dates.htm :
I hear that Safari 1.2.3 on Mac OS 10.3. shows a range of
+-2^31 seconds from zero - 1901-12-13 to 2038-01-19 GMT.

ECMA requires +-10^8 days. Safari's fault is grievous. In it, 30-year
look-ahead for US mortgages will fail in under 33 months from now. The
true range will probably be -2^31 to 2^31-1.

<URL:http://www.merlyn.demon.co.uk/js-index.htm#SDB>, first yellow box,
should show that range, for Safari users; it determines the borders
outside which new Date(x) gives NaN.

And it had trouble with "setting" the date
...

Without knowing what you get, and what you expected, I can't really
comment on that. Remember that you (probably) see effects of Summer
Time.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,265
Latest member
TodLarocca

Latest Threads

Top