Below is the code I am working with:
app.filter('myDateFormat',function myDateFormat($filter){
return function(text){
var tempdate= new Date(text.replace(/-/g,"/"));
return $filter('date')(tempdate, "dd-MM-yyyy HH:mm:ss");
}
});
This filter takes the date from a database and formats it correctly. Here is how it is used in the HTML:
<li ng-repeat="rows in latestqs | limitTo:12">
<a href="#pubres/{{ rows._id }}"> {{ rows.title }} </a>
<br>
<small>by {{ rows.group_name }} @ {{ rows._createdAt | myDateFormat }}</small>
</li>
While this code works smoothly on Chrome, it encounters issues on IE9 where it displays as:
NaN-NaN-NaN-0NaN NaN:NaN:NaN
On Chrome, however, it shows as:
19-03-2014 14:00:19
Are there any suggestions on how to fix this problem?