From 1d655a4ddb30265f6138aa27fc11a1676c74bff4 Mon Sep 17 00:00:00 2001 From: hacksalot Date: Fri, 8 Jan 2016 12:13:54 -0500 Subject: [PATCH] Support duration units for JRS resumes. --- src/core/jrs-resume.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core/jrs-resume.js b/src/core/jrs-resume.js index 05bf70a..6c30550 100644 --- a/src/core/jrs-resume.js +++ b/src/core/jrs-resume.js @@ -274,7 +274,8 @@ Definition of the JRSResume class. *latest end date of all jobs in the work history*. This last condition is for sheets that have overlapping jobs. */ - JRSResume.prototype.duration = function() { + JRSResume.prototype.duration = function( unit ) { + unit = unit || 'years'; if( this.work && this.work.length ) { var careerStart = this.work[ this.work.length - 1].safeStartDate; if ((typeof careerStart === 'string' || careerStart instanceof String) && @@ -283,7 +284,7 @@ Definition of the JRSResume class. var careerLast = _.max( this.work, function( w ) { return w.safeEndDate.unix(); }).safeEndDate; - return careerLast.diff( careerStart, 'years' ); + return careerLast.diff( careerStart, unit ); } return 0; };