The filter I created below works on Chrome but not Firefox. I don't understand why.
myApp.filter('dateCustom', [ '$filter', function ($filter) {
return function (input) {
// input => 2014-05-13 15:04:48
if(angular.isDefined(input)){
var d = new Date(input);
var time = d.getTime();
return $filter('date')(time,'dd/MM/yyyy');
}
}
}]);
HTML :
<span> {{ project.date_created_at | dateCustom }} </span>
Chrome
Firefox
Firefox doesn't support a date in that format, you will have to replace the dash's with slashes first.
var d = new Date(input.replace(/-/g, '/'));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With