* Add missing modules to package.json

* Start replacing some code with momentjs
This commit is contained in:
Bryan Ashby 2015-07-22 16:37:11 -06:00
parent 735b572f9f
commit 40a4f8caba
4 changed files with 19 additions and 6 deletions

View file

@ -9,6 +9,7 @@ var crypto = require('crypto');
var assert = require('assert');
var async = require('async');
var _ = require('lodash');
var moment = require('moment');
exports.User = User;
exports.getUserIdAndName = getUserIdAndName;
@ -333,7 +334,10 @@ User.prototype.getFormattedBirthDate = function(style) {
};
User.prototype.getAge = function() {
var birthDate = new Date(Date.parse(this.properties.birthdate));
if(_.has(this.properties, 'birthdate')) {
return moment().diff(this.properties.birthdate, 'years');
}
/*
if(!isNaN(birthDate)) {
var today = new Date();
var age = today.getFullYear() - birthDate.getFullYear();
@ -344,6 +348,7 @@ User.prototype.getAge = function() {
return age;
}
*/
};
///////////////////////////////////////////////////////////////////////////////