mirror of
https://github.com/NuSkooler/enigma-bbs.git
synced 2025-06-06 20:55:30 +02:00
* Add missing modules to package.json
* Start replacing some code with momentjs
This commit is contained in:
parent
735b572f9f
commit
40a4f8caba
4 changed files with 19 additions and 6 deletions
|
@ -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;
|
||||
}
|
||||
*/
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue