Martin Dimitrov 594d0ec8cd
Some checks failed
Build and push image for doorman-homeassistant / docker (push) Successful in 56s
Build and push image for doorman-homeassistant / deploy-gitainer (push) Successful in 5s
Build and push Doorman UI / API / docker (push) Failing after 2m21s
change TTL to seconds in ddb
2025-10-11 14:39:50 -07:00

19 lines
430 B
TypeScript

export function isTTLInFuture(item?: { TTL: number }) {
if (!item) {
return false;
}
// ttl is a UTC ms time
const ttl = item.TTL || 0;
return parseInt("" + ttl) > getCurrentTimeInSeconds();
}
export function getCurrentTimeInSeconds(): number {
return Date.now() / 1000;
}
export function getFutureTTLInSeconds(timeInFutureSeconds: number): number {
return getCurrentTimeInSeconds() + timeInFutureSeconds;
}