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).
frontend ruleP2stack specificStack: react
reactpropsdates
Pass date strings as props and parse at point of use
Prefer passing a date string between components and converting to a Date where you actually need it, validating it in the consumer.
PR: hegnar-web · org-mining-hist-2026-06Created: Jun 19, 2026
Bad example
Old codetsx
| 1 | <TimestampTag date={new Date(item.published)} /> |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetsx
| 1 | <TimestampTag date={item.published} /> // string; parsed inside the component |
Explanation (EN)
Objašnjenje (HR)