on-internet
← Community

Uncaught TypeError: Cannot read property 'filter' of undefined

Stack Overflow ·

My custom filter is giving me an error. Uncaught TypeError: Cannot read property 'filter' of undefined code : angular.module('PatientApp', []).filter('ageFilter', function() { // birthday is a date function calculateAge(birthday) { var dateOut = new Date(birthday); dateOut.setDate(dateOut.getDate() + 1); var ageDifMs = Date.now() - dateOut .getTime(); // miliseconds from epoch var ageDate = new Date(ageDifMs); return Math.abs(ageDate.getUTCFullYear() - 1970); } return function(birthdate) { return calculateAge(birthdate); }; });

Comments

Sign in or sign up to comment and upvote.

No comments yet.