Fix OCR receipt date parser (useMaintenanceReceiptOcr.ts) to use local time formatting instead of toISOString().split('T')[0] which converts to UTC and shifts dates by one day
Standard date parsing now uses getFullYear/getMonth/getDate (local time)
MM/DD/YYYY parsing formats directly from regex match groups without round-tripping through a Date object
Note: 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 remaining toISOString() usage in the OCR date parser.
Test plan
Edit a maintenance record and verify the date in the edit dialog matches the list view exactly
Save a record without changing anything and confirm the date does not shift
Pick a new date via DatePicker and confirm it saves correctly
Upload a receipt via OCR and verify the extracted date is correct
Verify fuel logs (TIMESTAMP columns) are unaffected
Fixes #237
## Summary
- Fix OCR receipt date parser (`useMaintenanceReceiptOcr.ts`) to use local time formatting instead of `toISOString().split('T')[0]` which converts to UTC and shifts dates by one day
- Standard date parsing now uses `getFullYear/getMonth/getDate` (local time)
- MM/DD/YYYY parsing formats directly from regex match groups without round-tripping through a `Date` object
Note: 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 remaining `toISOString()` usage in the OCR date parser.
## Test plan
- [ ] Edit a maintenance record and verify the date in the edit dialog matches the list view exactly
- [ ] Save a record without changing anything and confirm the date does not shift
- [ ] Pick a new date via DatePicker and confirm it saves correctly
- [ ] Upload a receipt via OCR and verify the extracted date is correct
- [ ] Verify fuel logs (TIMESTAMP columns) are unaffected
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) <[email protected]>
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) <[email protected]>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
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) <[email protected]>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) <[email protected]>