diff options
| author | Georgios Andreadis <g.andreadis@student.tudelft.nl> | 2017-01-26 22:06:06 +0100 |
|---|---|---|
| committer | Georgios Andreadis <g.andreadis@student.tudelft.nl> | 2017-01-26 22:06:06 +0100 |
| commit | 6a1bc9ab81adf8eea68337c80d1bf80ffb6c8604 (patch) | |
| tree | 95147f68cfd6c65b1f20370d2af387f2c9f29f54 /src | |
| parent | 1bbe2fb939d55c4a1389d4cde4db4bfebe0ef6f9 (diff) | |
Fix NaN on invalid second input to time format
Diffstat (limited to 'src')
| -rw-r--r-- | src/scripts/util.ts | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/scripts/util.ts b/src/scripts/util.ts index 74bdb710..d0c6dd38 100644 --- a/src/scripts/util.ts +++ b/src/scripts/util.ts @@ -529,6 +529,11 @@ export class Util { let hour = Math.floor(seconds / 3600); let minute = Math.floor(seconds / 60) % 60; let second = seconds % 60; + + hour = isNaN(hour) ? 0 : hour; + minute = isNaN(minute) ? 0 : minute; + second = isNaN(second) ? 0 : second; + return this.addPaddingToTwo(hour) + ":" + this.addPaddingToTwo(minute) + ":" + this.addPaddingToTwo(second); |
