Files
saltbo__agent-kanban/shared/datetime.ts
jarvis a2fa54a729 feat!: rebuild Agent Kanban for Realmroot Toolbox
Replace the v1 Agent/Machine runtime and CLI architecture with the v2 Resource Server, AMA-backed projections, task lifecycle, session observation, BDD specifications, and a single-package layered codebase.

BREAKING CHANGE: remove the v1 CLI, internal Agent/Machine runtime entities, workspace layout, and legacy runtime coordination APIs.
2026-09-02 00:17:52 -04:00

15 lines
570 B
TypeScript

// Strict ISO 8601 datetime with required timezone (Z or ±HH:mm)
const ISO_8601_RE = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})$/;
/**
* Parse a strict ISO 8601 datetime string and return UTC ISO string.
* Requires full datetime with timezone. Rejects date-only, ambiguous, or non-standard formats.
* Returns null if invalid.
*/
export function parseScheduledAt(value: string): string | null {
if (!ISO_8601_RE.test(value)) return null;
const d = new Date(value);
if (Number.isNaN(d.getTime())) return null;
return d.toISOString();
}