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

Commit 20fb4ff

Browse files
committed
feat(extensions): Starts adding functions for extension values.
1 parent 80de693 commit 20fb4ff

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

package-lock.json

Lines changed: 8 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
"dependencies": {
2626
"axios": "^0.18.0",
2727
"base-64": "^0.1.0",
28-
"lodash": "^4.17.11"
28+
"lodash": "^4.17.11",
29+
"moment": "^2.24.0"
2930
},
3031
"devDependencies": {
3132
"@ht2-labs/semantic-release": "1.1.27",
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import moment from 'moment';
2+
import { plannedDuration, plannedDurationBreakdown } from '../statementConstants/extensions';
3+
4+
export function extendWithPlannedDuration(isoDuration?: string) {
5+
if (isoDuration === undefined) {
6+
return {};
7+
}
8+
const momentDuration = moment.duration(isoDuration);
9+
return {
10+
[plannedDuration]: isoDuration,
11+
[plannedDurationBreakdown]: {
12+
days: momentDuration.as('days'),
13+
hours: momentDuration.as('hours'),
14+
minutes: momentDuration.as('minutes'),
15+
},
16+
};
17+
}

0 commit comments

Comments
 (0)