* 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

@ -20,6 +20,7 @@ var packageJson = require('../package.json');
var assert = require('assert'); var assert = require('assert');
var os = require('os'); var os = require('os');
var _ = require('lodash'); var _ = require('lodash');
var moment = require('moment');
exports.MCIViewFactory = MCIViewFactory; exports.MCIViewFactory = MCIViewFactory;
@ -39,7 +40,8 @@ MCIViewFactory.prototype.getPredefinedViewLabel = function(code) {
UR : this.client.user.properties.real_name, UR : this.client.user.properties.real_name,
LO : this.client.user.properties.location, LO : this.client.user.properties.location,
UA : this.client.user.getAge().toString(), UA : this.client.user.getAge().toString(),
UB : this.client.user.getFormattedBirthDate('medium'), UB : moment(this.client.user.properties.birthdate).format('MM/DD/YYYY'),
//UB : this.client.user.getFormattedBirthDate('medium'),
US : this.client.user.properties.sex, US : this.client.user.properties.sex,
UE : this.client.user.properties.email_address, UE : this.client.user.properties.email_address,
UW : this.client.user.properties.web_address, UW : this.client.user.properties.web_address,

View File

@ -43,7 +43,7 @@ function MenuModule(options) {
switch(artAsset.type) { switch(artAsset.type) {
case 'art' : case 'art' :
theme.displayThemeArt(dispOptions, function displayed(err, themeArtData) { theme.displayThemeArt(dispOptions, function displayed(err, themeArtData) {
cb(err, { mciMap : themeArtData.mciMap, height : themeArtData.extraInfo.height } ); cb(err, err ? null : { mciMap : themeArtData.mciMap, height : themeArtData.extraInfo.height } );
}); });
break; break;
@ -77,7 +77,9 @@ function MenuModule(options) {
function displayMenuArt(callback) { function displayMenuArt(callback) {
if(_.isString(self.menuConfig.art)) { if(_.isString(self.menuConfig.art)) {
self.displayArtAsset(self.menuConfig.art, function displayed(err, artData) { self.displayArtAsset(self.menuConfig.art, function displayed(err, artData) {
if(!err) {
mciData.menu = artData.mciMap; mciData.menu = artData.mciMap;
}
callback(err); callback(err);
}); });
} else { } else {
@ -103,7 +105,9 @@ function MenuModule(options) {
// :TODO: allow inline prompts in the future, e.g. @inline:memberName -> { "memberName" : { "text" : "stuff", ... } } // :TODO: allow inline prompts in the future, e.g. @inline:memberName -> { "memberName" : { "text" : "stuff", ... } }
var promptConfig = self.menuConfig.promptConfig; var promptConfig = self.menuConfig.promptConfig;
self.displayArtAsset(promptConfig.art, function displayed(err, artData) { self.displayArtAsset(promptConfig.art, function displayed(err, artData) {
if(!err) {
mciData.prompt = artData.mciMap; mciData.prompt = artData.mciMap;
}
callback(err); callback(err);
}); });
} else { } else {

View File

@ -9,6 +9,7 @@ var crypto = require('crypto');
var assert = require('assert'); var assert = require('assert');
var async = require('async'); var async = require('async');
var _ = require('lodash'); var _ = require('lodash');
var moment = require('moment');
exports.User = User; exports.User = User;
exports.getUserIdAndName = getUserIdAndName; exports.getUserIdAndName = getUserIdAndName;
@ -333,7 +334,10 @@ User.prototype.getFormattedBirthDate = function(style) {
}; };
User.prototype.getAge = function() { 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)) { if(!isNaN(birthDate)) {
var today = new Date(); var today = new Date();
var age = today.getFullYear() - birthDate.getFullYear(); var age = today.getFullYear() - birthDate.getFullYear();
@ -344,6 +348,7 @@ User.prototype.getAge = function() {
return age; return age;
} }
*/
}; };
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////

View File

@ -14,7 +14,9 @@
"ssh2" : "0.4.x", "ssh2" : "0.4.x",
"strip-json-comments" : "1.0.x", "strip-json-comments" : "1.0.x",
"gapbuffer" : "0.0.2", "gapbuffer" : "0.0.2",
"node-uuid" : "1.4.x" "node-uuid" : "1.4.x",
"moment" : "2.10.x",
"gaze" : "0.5.x"
}, },
"engine" : "node >= 0.12.2" "engine" : "node >= 0.12.2"
} }