Ramco Ramco

Ramco Ramco

  • 441
  • 3.4k
  • 523k

Invalid Date

Oct 14 2022 11:10 AM

Hi

  In alert it is showing 16-10-22 but it is giving message Invalid Date

 <script type="text/javascript">
        function DoValidation(parameter) {

            var valid = true;

            var txtRemark = document.getElementById("txtRemarks").value;
            var ddlStatus = "";
            if (document.getElementById('ddlStatus')) {
                var ddlStatus0 = document.getElementById("ddlStatus");
                ddlStatus = ddlStatus0.value;
            }


            var theDate = document.getElementById("txtReceivedOn").value;
            alert(theDate);
            if (ddlStatus == "Return Delivered" && (theDate.trim() === "" || isNaN(new Date(theDate).getTime()))) {
                bootbox.alert({
                    size: 'small',
                    title: 'Error!',
                    message: 'Invalid Date'
                });
                valid = false;
            }
            return valid;
        };
    </script>

Thanks


Answers (2)