After creating a filter to convert my date to time, I decided to name it the official filter "date" of AngularJS.
project.date_created_at
and project.mel
have different formats, so I needed to create a custom filter for project.date_created_at
.
HTML :
<span>{{ project.date_created_at | dateCustom }}</span>
<span>{{ project.mel | date:'dd/MM/yyyy' }}</span>
JS :
myApp.filter('dateCustom', function () {
return function (input) {
if(input != undefined) {
var d = new Date(input);
var time = d.getTime();
// use official $filter('date') here ?
}
}
});
The desired format is:
date:'dd/MM/yyyy'