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

Commit 4849aeb

Browse files
Merge pull request #60 from Financial-Times/use-formatted-duration
Use `formattedDuration` from next-api
2 parents 7901fe1 + 19c0332 commit 4849aeb

File tree

2 files changed

+1
-11
lines changed

2 files changed

+1
-11
lines changed

src/data-model/fragments.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ module.exports = {
5050
relativeUrl
5151
}
5252
...on Video {
53-
duration
53+
formattedDuration(format: "m:ss")
5454
}
5555
}
5656
`,

src/presenters/teaser-presenter.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -145,16 +145,6 @@ const TeaserPresenter = class TeaserPresenter {
145145
}
146146
}
147147

148-
// returns duration in the format m:ss
149-
get formattedDuration () {
150-
const duration = this.data.duration;
151-
if (duration > 0) {
152-
const minutes = Math.floor(duration / (1000 * 60));
153-
const seconds = Math.round(duration / 1000) - (minutes * 60);
154-
return `${minutes}.${seconds < 10 ? '0' : ''}${seconds}`;
155-
}
156-
}
157-
158148
// returns class modifier for live blog label
159149
get liveBlogLabelModifier () {
160150
return LIVEBLOG_MAPPING[this.data.status.toLowerCase()].labelModifier;

0 commit comments

Comments
 (0)