diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml new file mode 100644 index 0000000..725f9b5 --- /dev/null +++ b/docker-compose.dev.yml @@ -0,0 +1,24 @@ +version: '3.8' + +services: + postgres: + image: postgres:16 + container_name: postgres-dev + restart: unless-stopped + environment: + POSTGRES_USER: root + POSTGRES_PASSWORD: password + POSTGRES_DB: database + ports: + - "3306:5432" + volumes: + - postgres_data:/var/lib/postgresql/data + healthcheck: + test: [ "CMD-SHELL", "pg_isready -U postgres" ] + interval: 10s + timeout: 5s + retries: 5 + +volumes: + postgres_data: + driver: local \ No newline at end of file diff --git a/src/util/timespan.ts b/src/util/timespan.ts index bd9631c..07ae64d 100644 --- a/src/util/timespan.ts +++ b/src/util/timespan.ts @@ -24,12 +24,10 @@ function getDuration(duration: string): number { case "minute": case "m": return 1000 * 60; - case "seconds": case "second": case "s": return 1000; - default: return 0; } @@ -52,9 +50,9 @@ export function parseTimespan(span: string): number { let out = 0; for (const element of inputSplit) { - const number = parseInt(element.groups?.[1] ?? "0", 10); + const number = Number.parseInt(element[1], 10); if (Number.isNaN(number)) continue; - out += number * getDuration(element.groups?.[2] ?? ""); + out += number * getDuration(element[2]); } return out; }