From 495deb1815b465230d0831d0132e85ba207ac528 Mon Sep 17 00:00:00 2001 From: Georgios Andreadis Date: Sun, 26 Feb 2017 16:47:07 +0100 Subject: Fix chart handling of time values above 100s --- src/scripts/util.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/scripts/util.ts') 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; + }); + } } -- cgit v1.2.3