Skip to content
This repository has been archived by the owner on Dec 14, 2020. It is now read-only.

Commit

Permalink
feat(extensions): Starts adding functions for extension values.
Browse files Browse the repository at this point in the history
  • Loading branch information
ryasmi committed Mar 14, 2019
1 parent 80de693 commit 20fb4ff
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
9 changes: 8 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
"dependencies": {
"axios": "^0.18.0",
"base-64": "^0.1.0",
"lodash": "^4.17.11"
"lodash": "^4.17.11",
"moment": "^2.24.0"
},
"devDependencies": {
"@ht2-labs/semantic-release": "1.1.27",
Expand Down
17 changes: 17 additions & 0 deletions src/extensions/extendWithPlannedDuration.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import moment from 'moment';
import { plannedDuration, plannedDurationBreakdown } from '../statementConstants/extensions';

export function extendWithPlannedDuration(isoDuration?: string) {
if (isoDuration === undefined) {
return {};
}
const momentDuration = moment.duration(isoDuration);
return {
[plannedDuration]: isoDuration,
[plannedDurationBreakdown]: {
days: momentDuration.as('days'),
hours: momentDuration.as('hours'),
minutes: momentDuration.as('minutes'),
},
};
}

0 comments on commit 20fb4ff

Please sign in to comment.