const KEY = 'inkling.recoveryDismissedAt';

export function isRecoveryDismissedToday(now = new Date()): boolean {
  const v = localStorage.getItem(KEY);
  if (!v) return false;
  const stored = new Date(v);
  const kstNow = new Date(now.getTime() + 9 * 3600_000).toISOString().slice(0, 10);
  const kstStored = new Date(stored.getTime() + 9 * 3600_000).toISOString().slice(0, 10);
  return kstNow === kstStored;
}

export function markRecoveryDismissed(now = new Date()): void {
  localStorage.setItem(KEY, now.toISOString());
}
