日付チェックを完璧に行うには?

[上に] [前に] [次に]
やまさん 2000/02/25(金) 00:06:20
初心者ですので、何卒宜しくお願い致します。
日付チェックについてですが、(少し長い文ですが御勘弁下さい)
  // 利用開始日
    if (EDate != "") {
        errMsg = "";
        if (EDate == -1) {
            errMsg = "利用開始日(yyyy/mm/dd) ";
        }
        data1 = new Date(EDate);
        if (data1 == "Invalid Date") {
            errMsg = "利用開始日(yyyy/mm/dd) ";
        } else {
            data2 = data1.toGMTString();
            y1 = data1.getYear() + 1900;
        m1 = data1.getMonth() + 1;
        d1 = data1.getDate();
        ymd = y1 + "/" + m1 + "/" + d1;
        EDate = ymd;
        }
        if (errMsg.length == 0) {
            document.form_button.PoEfectDate.value = EDate;
        } else {
            errMsg = errMsg + "の指定に誤りがあります。";
            alert(errMsg);
            flg = 1;
        }
    }
と言うプログラムがあり、完璧な日付チェックをしたいときいたところ
下記を追加しろと言われたのですが、うまく稼動しません。
どのようにすれば稼動するのでしょうか?
宜しく御指導お願い致します。

function calendar_3 () {
                var     date, today, year, month, day, week, msg, holiday;
                var     bgcol, fgcol, fontsize, title_col

                holiday = false;
                bgcol = document.bgColor
                fgcol = document.fgColor
                fontsize = 2

                //
                // 今日の日付取得
                //
                date    = new Date();
                year    = date.getYear();
                month   = date.getMonth();
                today   = date.getDate();

                //
                // browser check
                //
                var     browser = navigator.appName;
                if (browser.indexOf("Netscape") == -1) {
                        //
                        // ブラウザが Netscape Navigator 以外の処理
                        // (つまり Internet Explore の時を想定している)
                        //
                        year += 1900;
                }
                else {
                        //
                        // ブラウザが Netscape Navigator の処理
                        //
                        if (year < 2000) {
                                year += 1900;
                        }
                }
                //
                // 日数設定
                //
                var     m_tbl = new Array(12);
                m_tbl[0] = 31;          // Jan
                m_tbl[1] = 28;          // Feb
                m_tbl[2] = 31;          // Mar
                m_tbl[3] = 30;          // Apr
                m_tbl[4] = 31;          // May
                m_tbl[5] = 30;          // Jun
                m_tbl[6] = 31;          // Jul
                m_tbl[7] = 31;          // Aug
                m_tbl[8] = 30;          // Sep
                m_tbl[9] = 31;          // Oct
                m_tbl[10] = 30;         // Nov
                m_tbl[11] = 31;         // Dec

                var     m_name_tbl = new Array(12);
                m_name_tbl[0] = "Jan";
                m_name_tbl[1] = "Feb";
                m_name_tbl[2] = "Mar";
                m_name_tbl[3] = "Apr";
                m_name_tbl[4] = "May";
                m_name_tbl[5] = "Jun";
                m_name_tbl[6] = "Jul";
                m_name_tbl[7] = "Aug";
                m_name_tbl[8] = "Sep";
                m_name_tbl[9] = "Oct";
                m_name_tbl[10] = "Nov";
                m_name_tbl[11] = "Dec";
                //
                // 祝日フラグ配列作成
                //
                var     h_flg = new Array(12);
                for (i = 0; i < 12; i++) {
                        var     base = new Array(31);
                        for (j = 0; j < 31; j++) {
                                base[j] = 0;
                        }
                        h_flg[i] = base;
                }
                // 1月
                h_flg[0][0]     = 1;
                h_flg[0][14]    = 1;
                // 2月
                h_flg[1][11]    = 1;
                // 3月
                h_flg[2][20]    = 1;    // 一定ではないので注意
                // 4月
                h_flg[3][28]    = 1;
                // 5月
                h_flg[4][2]     = 1;
                h_flg[4][3]     = 1;
                h_flg[4][4]     = 1;
                // 6月
                // 7月
                h_flg[6][19]    = 1;
                // 8月
                // 9月
                h_flg[8][14]    = 1;
                h_flg[8][22]    = 1;    // 一定ではないので注意
                // 10月
                h_flg[9][9]     = 1;
                // 11月
                h_flg[10][2]    = 1;
                h_flg[10][22]   = 1;
                h_flg[10][23]   = 1;
                // 12月
                h_flg[11][22]   = 1;
                //
                // うるう年チェック
                //
                if (month == 1) {
                        if (year % 4 == 0) {
                                if (year % 100 == 0) {
                                        if (((year / 100) % 4) == 0) {
                                                m_tbl[1] = 29;
                                        }
                                }
                                else {
                                        m_tbl[1] = 29;
                                }
                        }
                }

[上に] [前に] [次に]