Add timestamp utilities with helpful names
This commit is contained in:
parent
9fa3359477
commit
a75402d290
8 changed files with 71 additions and 17 deletions
10
ts/util/timestamp.ts
Normal file
10
ts/util/timestamp.ts
Normal file
|
@ -0,0 +1,10 @@
|
|||
// Copyright 2021 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
export function isMoreRecentThan(timestamp: number, delta: number): boolean {
|
||||
return timestamp > Date.now() - delta;
|
||||
}
|
||||
|
||||
export function isOlderThan(timestamp: number, delta: number): boolean {
|
||||
return timestamp <= Date.now() - delta;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue