diff options
| author | Georgios Andreadis <g.andreadis@student.tudelft.nl> | 2017-02-26 16:47:07 +0100 |
|---|---|---|
| committer | Georgios Andreadis <g.andreadis@student.tudelft.nl> | 2017-02-26 16:47:07 +0100 |
| commit | 495deb1815b465230d0831d0132e85ba207ac528 (patch) | |
| tree | 6a2589cb5cdc86bdcfe47f4b399f385c6a5ecbc7 /src/scripts/util.ts | |
| parent | d3b9ebd5d79ca42d816d75bfb4bb19fcb2f1f9a8 (diff) | |
Fix chart handling of time values above 100s
Diffstat (limited to 'src/scripts/util.ts')
| -rw-r--r-- | src/scripts/util.ts | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/scripts/util.ts b/src/scripts/util.ts index 7aa615ec..d3a2ea58 100644 --- a/src/scripts/util.ts +++ b/src/scripts/util.ts @@ -599,4 +599,15 @@ export class Util { return i.toString(); }) } + + /** + * Returns an array containing all numbers of a range from 0 to x (including x). + */ + public static timeRange(x: number): Date[] { + return Util.range(x).map((tick: number) => { + const t = new Date(1970, 0, 1); // Epoch + t.setSeconds(tick); + return t; + }); + } } |
