init; collecting some of my commonly used utils

This commit is contained in:
2024-04-01 17:31:33 -05:00
commit a09a7d7337
13 changed files with 322 additions and 0 deletions

17
pkg/time.ts Normal file
View File

@@ -0,0 +1,17 @@
export default class Time {
static SECOND = 1000;
static MINUTE = this.SECOND * 60;
static HOUR = this.MINUTE * 60;
static DAY = this.HOUR * 24;
static WEEK = this.DAY * 7;
static MONTH = this.DAY * 30;
static YEAR = this.DAY * 365;
static seconds = (n: number) => n * this.SECOND;
static minutes = (n: number) => n * this.MINUTE;
static hours = (n: number) => n * this.HOUR;
static days = (n: number) => n * this.DAY;
static weeks = (n: number) => n * this.WEEK;
static months = (n: number) => n * this.MONTH;
static years = (n: number) => n * this.YEAR;
}