Employee Validation

  • + 0 comments

    check the date if its valid

    function check_date(value) { const date = value; setJoinDay(date); const today = new Date(); const selected = new Date(date);

        today.setHours(0, 0, 0, 0);
    
        if (selected > today) {
            setErrorDay("Joining Date cannot be in the future");
        } else {
            setErrorDay("");
        }
    }