Angularjs, date input : enter a date manually with a specific format

445 Views Asked by At

I need to user a date component in Angularjs.
The users asked me allow them to enter the date manually (not with a datepicker) and to put a mask on the input : (__/ __ / __).
Also, important, the date has to have this format : dd/mm/yy.

I have searched on internet but couldn't find such a component.

Does anyone know if it exists?

Thanks in advance.

1

There are 1 best solutions below

0
On

This blog entry could help

ngModel.$parsers.push(function(data) {
    // convert data from view format to model format
    var splitted = data.split('.');
    var convertedDate = splitted[1] + "/" + splitted[0] + "/" + splitted[2];
    return new Date(Date.parse(convertedDate)); // converted
});