Rules Hub
Coding Rules Library
← Back to all rules
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
fullstack ruleP1universalStack: universal
datestimezonesssrcorrectness
Specify the timezone explicitly when formatting dates
Date math that runs on both server and client must pass an explicit timeZone or it will use the ambiguous server timezone.
PR: hegnar-components · org-mining-deep-2026-06Created: Jun 17, 2026
Bad example
Old codetypescript
| 1 | new Intl.DateTimeFormat('nb-NO').format(date); // uses server's local tz |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | new Intl.DateTimeFormat('nb-NO', { timeZone: 'Europe/Oslo' }).format(date); |
Explanation (EN)
Objašnjenje (HR)