summaryrefslogtreecommitdiff
path: root/src/scripts/util.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/scripts/util.ts')
-rw-r--r--src/scripts/util.ts11
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;
+ });
+ }
}