* MCI keys no longer consider view IDs as this implied order

* Converted all MCI keys in menu.json/etc., e.g. BN1ET2 -> BN1ET2
* Fix regression with prompt loading
* 'age' property -> 'birthdate'
* MaskEditView.getData() returns data with literals in place
* Other minor changes
This commit is contained in:
Bryan Ashby 2015-07-21 23:52:20 -06:00
parent 81e684cdcc
commit 735b572f9f
14 changed files with 93 additions and 32 deletions

View file

@ -319,6 +319,33 @@ User.prototype.persistProperties = function(cb) {
});
};
// :TODO: A general purpose date/time formatting class or lib would be better here....
User.prototype.getFormattedBirthDate = function(style) {
style = style || 'medium';
switch(style) {
case 'medium' :
return _.has(this.properties, 'birthdate') ?
new Date(Date.parse(this.properties.birthdate)).toJSON().slice(0, 10) :
null;
}
};
User.prototype.getAge = function() {
var birthDate = new Date(Date.parse(this.properties.birthdate));
if(!isNaN(birthDate)) {
var today = new Date();
var age = today.getFullYear() - birthDate.getFullYear();
var m = today.getMonth() - birthDate.getMonth();
if(m < 0 || (m === 0 && today.getDate() < birthDate.getDate())) {
age--;
}
return age;
}
};
///////////////////////////////////////////////////////////////////////////////
// Exported methods
///////////////////////////////////////////////////////////////////////////////