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).
backend ruleP2universalStack: TypeScript
consistencydatestypesdto
Use consistent date types across DTOs and tests
Represent the same conceptual field with a consistent type everywhere (always Date or always ISO string); mixing them within the same codebase causes confusion and serialization bugs.
PR: vinify-backend · org-mining-hist-2026-06Created: Jun 19, 2026
Bad example
Old codetypescript
| 1 | createdAt: new Date(), // here a Date |
| 2 | createdAt: '2022-01-01', // elsewhere a string |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | const date = new Date(2022, 1, 1); |
| 2 | createdAt: date; // same type everywhere |
Explanation (EN)
Objašnjenje (HR)