export function isValidDate(dateString: string): boolean {
    // Regular expression to match dd-mm-yyyy format
    const regex = /^(0[1-9]|[12][0-9]|3[01])-(0[1-9]|1[0-2])-(\d{4})$/;
    if (!regex.test(dateString)) {
        return false;
    }
    const [day, month, year] = dateString.split('-').map(Number);
    const date = new Date(year, month - 1, day);
 
    return date.getFullYear() === year &&
           date.getMonth() === month - 1 &&
           date.getDate() === day;
}


/*Write code for password format
password shouls be atleast 5 charecter
Password should be have one special charecter and one numeric value*/ 

export function validatePassword(password: string): boolean {

    if (password.length < 5) {
        return false;  //password should be atleast 5 charector long
    }
    const specialCharPattern = /[!@#$%^&*(),.?":{}|<>]/; // checking  at least one special character
    const numericPattern = /[0-9]/; //at least one numeric character
    if (!specialCharPattern.test(password)) {
        return false;
    }
    if (!numericPattern.test(password)) {
        return false;
    }    
    return true;
}
