nl_tokens: Takes in a start duration and a multiplier and returns a new Duration . Rounds using Math . round
pl_tokens: function multiplyDuration ( startDuration , multiplier ) { if ( ! isFinite ( multiplier ) || multiplier <= 0 ) { throw new Error ( 'Invalid Multiplier' ) ; } var newDuration = { } , hasTime = false , duration = '' ; if ( startDuration . getSeconds ( ) ) { newDuration . seconds = Math . round ( startDuration . getSeconds ( ) * multiplier ) ; } if ( startDuration . getMinutes ( ) ) { newDuration . minutes = Math . round ( startDuration . getMinutes ( ) * multiplier ) ; } if ( startDuration . getHours ( ) ) { newDuration . hours = Math . round ( startDuration . getHours ( ) * multiplier ) ; } if ( startDuration . getDays ( ) ) { newDuration . days = Math . round ( startDuration . getDays ( ) * multiplier ) ; } if ( startDuration . getMonths ( ) ) { newDuration . months = Math . round ( startDuration . getMonths ( ) * multiplier ) ; } if ( startDuration . getYears ( ) ) { newDuration . years = Math . round ( startDuration . getYears ( ) * multiplier ) ; } if ( newDuration . seconds ) { hasTime = true ; duration = newDuration . seconds + 'S' + duration ; } if ( newDuration . minutes ) { hasTime = true ; duration = newDuration . minutes + 'M' + duration ; } if ( newDuration . hours ) { hasTime = true ; duration = newDuration . hours + 'H' + <mask> ; } if ( hasTime ) { duration = 'T' + duration ; } if ( newDuration . days ) { duration = newDuration . days + 'D' + duration ; } if ( newDuration . months ) { duration = newDuration . months + 'M' + duration ; } if ( newDuration . years ) { duration = newDuration . years + 'Y' + duration ; } if ( ! duration ) { throw new Error ( 'Invalid Duration Multiplier' ) ; } return new Duration ( 'P' + duration ) ; }