Add durations utility for computing durations

This commit is contained in:
Evan Hahn 2021-08-26 09:10:58 -05:00 committed by GitHub
parent c6aa668a9b
commit f86f753df9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 99 additions and 95 deletions

View file

@ -1,18 +1,14 @@
// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import * as durations from '../../util/durations';
export type TestExpireTimer = Readonly<{ value: number; label: string }>;
const SECOND = 1;
const MINUTE = 60 * SECOND;
const HOUR = 60 * MINUTE;
const DAY = 24 * HOUR;
const WEEK = 7 * DAY;
export const EXPIRE_TIMERS: ReadonlyArray<TestExpireTimer> = [
{ value: 42 * SECOND, label: '42 seconds' },
{ value: 5 * MINUTE, label: '5 minutes' },
{ value: 1 * HOUR, label: '1 hour' },
{ value: 6 * DAY, label: '6 days' },
{ value: 3 * WEEK, label: '3 weeks' },
{ value: 42 * durations.SECOND, label: '42 seconds' },
{ value: 5 * durations.MINUTE, label: '5 minutes' },
{ value: 1 * durations.HOUR, label: '1 hour' },
{ value: 6 * durations.DAY, label: '6 days' },
{ value: 3 * durations.WEEK, label: '3 weeks' },
];