Angular 13 Typescript RegExp Date format dd/mm/yyyy

Discussão em 'Angular' iniciado por James, Novembro 20, 2024.

  1. James

    James Guest

    im working in Angular 13 project i want to create a directive to allow user only type numbers and '/' foor my date input. dd/mm/yyyy. this is my Regx :

    if (!String(myVal).match(new RegExp(/^\d+$/))) {
    event.preventDefault();
    }


    this condition is working but i can type only numbers can't type / to format my date. any suggestion to moify my Regx.

    Regards

    Continue reading...

Compartilhe esta Página