diff options
| author | Furkan Sahin <furkan-dev@proton.me> | 2022-06-01 10:41:57 -0500 |
|---|---|---|
| committer | Furkan Sahin <furkan-dev@proton.me> | 2022-06-01 10:41:57 -0500 |
| commit | 6de688df96e15e55dce189533d7b7c1c84a77154 (patch) | |
| tree | be9c7b96a6f8f8b00463001f8b6542bc5760fda6 /src | |
| parent | 49cf2deb61c112e05ee25ba8bfcdee46e51e4faa (diff) | |
Compute duration of an event based on { start, end, days }
Diffstat (limited to 'src')
| -rw-r--r-- | src/models/EventInfo.ts | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/models/EventInfo.ts b/src/models/EventInfo.ts index a6819db..693c8bb 100644 --- a/src/models/EventInfo.ts +++ b/src/models/EventInfo.ts @@ -57,4 +57,10 @@ export default class EventInfo { return `${this.days} ${EventInfo.timeToStr(this.start)}-${EventInfo.timeToStr(this.end)}`; } } + + get duration_mins() { + const diff_hours = Math.floor(this.end / 100) - Math.floor(this.start / 100); + const diff_mins = this.end % 100 - this.start % 100; + return (diff_hours * 60 + diff_mins) * this.days.length; + } }
\ No newline at end of file |
