剩下的日子在Firefox中显示NaN,Chrome可以完美运行-代码日志

时间:2019-06-17 13:08:53

标签: asp.net

“日期计算剩余天数”仅显示NaN Firefox。但是在chrome中可以正常工作

function check() {
        debugger
        $("#txtscap1_domicilesensitivecountryfromdate").on("click", function () {
        debugger
        var today = new Date();
        var monthNames = ["Jan", "Feb", "Mar", "Apr", "May", "Jun","Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
        ];
        var d = today.getFullYear() + "-" + monthNames[today.getMonth()] + "-" + today.getDate();
        var date = $("#txtscap1_domicilesensitivecountryfromdate").val();

        var date1 = Date.parse(d);
        var date2 = Date.parse(date);

        var days = Math.ceil((date1 - date2) / (1000 * 60 * 60 * 24));

        $("#txtscap1_domicilesensitivecountry_trigger").val(days);
        // alert(days);
        });
    }

2.5

0 个答案:

没有答案