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,7 +1,7 @@
// Copyright 2020-2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import moment from 'moment';
import * as durations from './durations';
import { LocalizerType } from '../types/Util';
import { getMutedUntilText } from './getMutedUntilText';
import { isMuted } from './isMuted';
@ -32,19 +32,19 @@ export function getMuteOptions(
: []),
{
name: i18n('muteHour'),
value: moment.duration(1, 'hour').as('milliseconds'),
value: durations.HOUR,
},
{
name: i18n('muteEightHours'),
value: moment.duration(8, 'hour').as('milliseconds'),
value: 8 * durations.HOUR,
},
{
name: i18n('muteDay'),
value: moment.duration(1, 'day').as('milliseconds'),
value: durations.DAY,
},
{
name: i18n('muteWeek'),
value: moment.duration(1, 'week').as('milliseconds'),
value: durations.WEEK,
},
{
name: i18n('muteAlways'),