I have simple use case where i want to validate date input it should be in the format "YYYY/MM/DD" if anything other format passed throw error so question how can i assign function to object property in typescript ?
main.ts
const ValidateRuless = [
{element: "date", values: this.validateDate()}
];
function validateDate(date: string) {
const date_regex = /^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/ ;
if (!(date_regex.test(date))) {
return false;
}
}