diff --git a/AGENTS.md b/AGENTS.md index ea36711..a6e7eee 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -412,6 +412,22 @@ Notes: --- +## Date & Time Formatting Rules + +- All date and time rendering must use the shared formatter in `src/lib/date-format.ts`. +- Never use `Date.prototype.toLocaleString()`, `toLocaleDateString()`, `toLocaleTimeString()`, or `Intl.DateTimeFormat()` directly inside React components. +- UI date display standard: + - Date: `YYYY-MM-DD` + - DateTime: `YYYY-MM-DD HH:mm:ss` + - Time: `HH:mm:ss` +- API responses must remain ISO-8601 UTC. +- UI is responsible for formatting. +- Timezone is fixed to `Asia/Bangkok`. +- Calendar system must always use Gregorian (AD), never Buddhist Era (BE). +- All formatting must be deterministic to ensure identical SSR and Client rendering and prevent React hydration mismatches. + +--- + ## Authentication Patterns ### Protected Routes diff --git a/docs/standards/project-foundations.md b/docs/standards/project-foundations.md index 0b45988..a9734da 100644 --- a/docs/standards/project-foundations.md +++ b/docs/standards/project-foundations.md @@ -377,3 +377,17 @@ If ADR coverage is incomplete, this registry marks the gap explicitly. - ALLA OS Foundation Registry = COMPLETE - ALLA OS Reuse Discovery = READY - ALLA OS Governance Quality = IMPROVED + +## Date & Time Formatting Rules + +- All date and time rendering must use the shared formatter in `src/lib/date-format.ts`. +- Never use `Date.prototype.toLocaleString()`, `toLocaleDateString()`, `toLocaleTimeString()`, or `Intl.DateTimeFormat()` directly inside React components. +- UI date display standard: + - Date: `YYYY-MM-DD` + - DateTime: `YYYY-MM-DD HH:mm:ss` + - Time: `HH:mm:ss` +- API responses must remain ISO-8601 UTC. +- UI is responsible for formatting. +- Timezone is fixed to `Asia/Bangkok`. +- Calendar system must always use Gregorian (AD), never Buddhist Era (BE). +- All formatting must be deterministic to ensure identical SSR and Client rendering and prevent React hydration mismatches.