Comparing dates in jquery

前端 未结 7 1680
鱼传尺愫
鱼传尺愫 2020-12-10 04:08

I am having the following codes and it though i\'m having 01-Jan-2009 for DateTo and 03-Jan-2009 for DateFrom it\'s readi

7条回答
  •  醉酒成梦
    2020-12-10 04:32

    My Comparison with the current date

        function isPastDate(dateText) {
    // date is dd/mm/yyyy
            var inputDate = dateText.split("/");
            var today = new Date();
            inputDate = new Date(inputDate[2], inputDate[1] - 1, inputDate[0], 0, 0, 0, 0);
            today = new Date(today.getFullYear(), today.getMonth(), today.getDate(), 0, 0, 0, 0);
            return inputDate < today;
    };
    

提交回复
热议问题