mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-24 03:15:46 -06:00
10 lines
375 B
TypeScript
10 lines
375 B
TypeScript
export function resolveMemoryCoreNowMs(nowMs?: number): number {
|
|
const candidate = nowMs ?? Number.NaN;
|
|
return new Date(candidate).toJSON() === null ? Date.now() : candidate;
|
|
}
|
|
|
|
export function resolveMemoryCoreTimestamp(nowMs?: number): string {
|
|
const timestampMs = resolveMemoryCoreNowMs(nowMs);
|
|
return new Date(timestampMs).toJSON() ?? new Date().toISOString();
|
|
}
|