fix: Maintenance dates display one day off due to timezone conversion (#237) #238
Reference in New Issue
Block a user
Delete Branch "issue-237-fix-date-timezone"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #237
Summary
useMaintenanceReceiptOcr.ts) to use local time formatting instead oftoISOString().split('T')[0]which converts to UTC and shifts dates by one daygetFullYear/getMonth/getDate(local time)DateobjectNote: The backend
setTypeParser(1082)fix, frontend edit dialog defensive parsing, and DatePicker onChange fixes were landed on main in prior commits (f0fc427,c05e33e,8955baa). This PR completes the fix by addressing the last remainingtoISOString()usage in the OCR date parser.Test plan
The parseServiceDate function used toISOString().split('T')[0] which converts to UTC, shifting dates by one day depending on timezone. Standard parsing now uses getFullYear/getMonth/getDate (local time). MM/DD/YYYY parsing now formats directly from regex groups without round-tripping through a Date object. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>new Date("YYYY-MM-DD") parses as UTC midnight per ES2015. toLocaleDateString() then displays in local time, shifting the date back one day for users west of UTC. This caused the list view and edit dialog to show different dates. Fixed in: MaintenanceRecordsList (display + sort + delete confirm), VehicleDetailPage (display + sort), VehicleDetailMobile (display + sort), MaintenanceRecordForm (receipt title), OwnershipCostsList (formatDate). Sorting now uses string comparison (YYYY-MM-DD is lexicographically sortable). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>