2020-12-01 23:52:09 +00:00
|
|
|
// Copyright 2020 Signal Messenger, LLC
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
|
|
|
/**
|
2024-07-23 15:43:44 +00:00
|
|
|
* Normalizes RingRTC group call timestamps (`addedTime` and `speakerTime`) into numbers.
|
2020-12-01 23:52:09 +00:00
|
|
|
*/
|
|
|
|
export function normalizeGroupCallTimestamp(
|
2024-07-23 15:43:44 +00:00
|
|
|
fromRingRtc: string
|
2020-12-01 23:52:09 +00:00
|
|
|
): undefined | number {
|
2024-07-23 15:43:44 +00:00
|
|
|
const asNumber = parseInt(fromRingRtc.slice(0, 15), 10);
|
2020-12-01 23:52:09 +00:00
|
|
|
|
|
|
|
if (Number.isNaN(asNumber) || asNumber <= 0) {
|
|
|
|
return undefined;
|
|
|
|
}
|
|
|
|
|
|
|
|
return asNumber;
|
|
|
|
}
|