From 05db06ceef77135d64f1603d6796812756f624bb Mon Sep 17 00:00:00 2001 From: Patrick J Cherry Date: Mon, 15 Feb 2021 15:30:32 +0000 Subject: [PATCH] Return zero if no birthdate is passed to getAge I think this should basically make anyone with no birthday zero years old.. --- web/public/js/services/user-utils.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/web/public/js/services/user-utils.js b/web/public/js/services/user-utils.js index f545b202c..f93d81b8b 100644 --- a/web/public/js/services/user-utils.js +++ b/web/public/js/services/user-utils.js @@ -10,6 +10,10 @@ angular.module('cpZenPlatform').factory('userUtils', var approvalRequired = ['mentor', 'champion']; userUtils.getAge = function (birthDate) { + if (birthDate === null) { + return 0; + } + return moment.utc().diff(moment(birthDate), 'years'); };