11 lines
433 B
TypeScript
11 lines
433 B
TypeScript
|
export function randomTimeUpTo2DaysInThePast() {
|
||
|
const now = Date.now();
|
||
|
const twoDaysAgo = now - 2 * 24 * 60 * 60 * 1000 - 3600 * 1000; // 1 hour buffer in case of clock skew
|
||
|
return Math.floor((Math.floor(Math.random() * (now - twoDaysAgo)) + twoDaysAgo) / 1000);
|
||
|
}
|
||
|
|
||
|
export function getMailSubscriptionDurationForSats(n: number) {
|
||
|
const twentyOneSatsToSeconds = 8640 / 21;
|
||
|
return Math.floor(n * twentyOneSatsToSeconds);
|
||
|
}
|