From f2bf09bf96f7badd1a85df420354ce2fdfd68220 Mon Sep 17 00:00:00 2001 From: hacksalot Date: Sun, 3 Jan 2016 09:48:22 -0500 Subject: [PATCH] Allow variable-unit resume duration. --- src/core/fresh-resume.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core/fresh-resume.js b/src/core/fresh-resume.js index c44b526..eaf3da0 100644 --- a/src/core/fresh-resume.js +++ b/src/core/fresh-resume.js @@ -359,7 +359,8 @@ Definition of the FRESHResume class. *latest end date of all jobs in the work history*. This last condition is for sheets that have overlapping jobs. */ - FreshResume.prototype.duration = function() { + FreshResume.prototype.duration = function(unit) { + unit = unit || 'years'; var empHist = __.get(this, 'employment.history'); if( empHist && empHist.length ) { var firstJob = _.last( this.employment.history ); @@ -370,7 +371,7 @@ Definition of the FRESHResume class. var careerLast = _.max( this.employment.history, function( w ) { return( w.safe && w.safe.end ) ? w.safe.end.unix() : moment().unix(); }); - return careerLast.safe.end.diff( careerStart, 'years' ); + return careerLast.safe.end.diff( careerStart, unit ); } return 0; };