Core Principles
- •Accuracy: Expiration calculations must be precise (time-zone aware).
- •Performance: Search indexing should not block the UI.
- •Validation: Strict input validation for product data.
CRITICAL RULES
1. Expiration Logic
- •ALWAYS calculate "Days Remaining" relative to the start of the current day.
- •Status Levels:
- •
> 30 days: Good - •
<= 30 days: Warning - •
<= 7 days: Critical - •
<= 0 days: Expired
- •
2. Barcode Handling
- •ALWAYS validate EAN-13 or UPC-A checksums if possible.
- •Strip leading zeros for normalization if beneficial for search.
3. Search Indexing
- •Local Search: When filtering products list, use a normalized string search (lowercase, accent-insensitive).
- •Debounce: Always debounce search inputs by at least 300ms.