export const checkDateOfBirth = (value: string) => { if (!value || value === "") return "Bu alan boş bırakılamaz."; const inputDate = value.substring(0, 2); const inputMonth = value.substring(3, 5); const inputYear = value.substring(6, 10); const newDate = new Date(); const date = newDate.getDate(); const month = newDate.getMonth() + 1; const year = newDate.getFullYear(); const customDate = new Date( `${inputMonth}.${inputDate}.${inputYear}`, ).getTime(); const todayDate = new Date().getTime(); if (customDate > todayDate) { return "Bugünden büyük tarihler girilemez."; } if (Number(inputYear) < year - 100) { return "Geçersiz tarih!"; } if (Number(inputYear) === year - 100) { if (Number(inputMonth) === month) { if (Number(inputDate) < date) { return "Geçersiz tarih!"; } } else if (Number(inputMonth) < month) { return "Geçersiz tarih!"; } } return true; };