The dates retrieved from the database have this format: 2013-11-21 17:43:20
This piece of code functions flawlessly in Chrome but encounters issues in FireFox:
<ul class="job-lookup-results" ng-show="data" style="padding:0 10px;">
<li class="job-lookup-result" ng-repeat="result in data" style="margin:5px 0; font-size:80%;"><a href="/admin/jobs/edit/{{result.Job.id}}" class="job-lookup-result-link">{{result.Job.name}}</a> ({{result.Job.id}}), {{result.Company.name}}, {{result.Job.created | dateToISO | date:'shortDate'}}</li>
<li class="job-lookup-result" ng-hide="data.length > 0">No matches found.</li>
</ul>
An error message indicates:
[15:17:40.890] "Error: [$interpolate:interr] http://errors.angularjs.org/1.2.5/$interpolate/interr?p0=%20(%7B%7Bresult.Job.id%7D%7D)%2C%20%7B%7Bresult.Company.name%7D%7D%2C%20%7B%7Bresult.Job.created%20%7C%20dateToISO%20%7C%20date%3A'shortDate'%7D%7D&p1=RangeError%3A%20invalid%20date
...
Though I am unsure of the error, here is my custom filter code:
app.filter('dateToISO', function() {
return function(input) {
input = new Date(input).toISOString();
return input;
};
});
Update:
Upon removing the | dateToISO |
, the code works fine, suggesting a connection to the custom filter.