Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org

Feedback: irt.org FAQ Knowledge Base Q1

Feedback on: irt.org FAQ Knowledge Base Q1

Sent by Mike Hughes-Chamberlain on January 07, 2000 at 09:26:24: - feedback #704

Worth:
Worth reading

Length:
Just right

Technical:
Just right

Comments:
I don't think this technique actually works - at any rate, not on my PC (using IE5 under NT4) - it does not seem to observe the correct number of days in each month. For example, 31/4/1957 is considered valid (whereas 31/4 does cause an error). Similarly, 29/2/nnnn works OK for any year, not just leap years.

(For testing, I simplified the isDate function as follows, but I don't think this will have made any difference.)

function isDate (day,month,year) {
var test = new Date(year,month,day);
if (day == 0) return false;
if (month == 0) return false;
if (year == 0) return false;
if ((year == test.getFullYear()) &&
(month == test.getMonth()) &&
(day == test.getDate()))
return true
else
return false
}





Sent by Mike Hughes-Chamberlain on January 07, 2000 at 09:32:09: - feedback #705

Comments:
Sorry, cancel previous feedback - I forgot about the (month-1) trick! The following simplified version works fine:

function isDate (day,month,year) {
var test = new Date(year,month-1,day);
if (day == 0) return false;
if (month == 0) return false;
if (year == 0) return false;
if ((year == test.getFullYear()) &&
(month == test.getMonth() + 1) &&
(day == test.getDate()))
return true
else
return false
}





Sent by jane godfrey on October 31, 2000 at 02:58:28: - feedback #1932

Worth:
Not worth reading

Comments:
the code is unreadable - is it in hieroglyphics?


Sent by LX on October 12, 2001 at 08:44:29: - feedback #3242

Worth:
Worth reading

Length:
Just right

Technical:
Just right

Comments:
The only problem: it doesn't work in Netscape 4.75 because it always returns a 'false'-value...


Sent by Takuya SATO on April 02, 2002 at 23:19:18: - feedback #3744

Worth:
Worth reading

Comments:
This page code helped me much, but
I found a bug.

It should be like this:
var test = new Date(year,month -1,day);
if ( (y2k(test.getYear()) == year) &&
(month == (test.getMonth() +1)) &&

JavaScript treates months from 0 - 11.
The original code seems to be fine, but does'nt work.
ex) month = 3, day = 31.


©2018 Martin Webb