Start Time To End Time Validation Client Site

  function ValidStartTimeEndTime(StartHH, StartMM, StartAM, EndHH, EndMM, EndAM) {

              if ((Number(StartAM) == Number(EndAM))) {
                if (EndHH != "12")
                {
                    if (Number(StartHH) > Number(EndHH)) {
                        alert("Not Allow To Hours");
                        return false;
                    }
                }
                if (Number(StartHH) == Number(EndHH)) {

                    if ((Number(StartMM) <= Number(EndMM)) || (Number(EndMM) == Number(StartMM))) {
                        return true;
                    }
                    else {
                        alert("Not Allow Min");
                        return false;
                    }
                }
                if (Number(StartHH) < Number(EndHH)) {
                    return true;
                }
            }
            else if (Number(StartAM) < Number(EndAM))
            {
                return true;
            }
            else {
                alert("Not Allow Time");
                return false;
            }
        }

Hi JAYRAJ,

Thanks for your post.

Please explain what is your problem, then we will focus on the right direction to fix it.

Thanks.

Best Regards,

Fei Han

Leave a Reply