Skip to content

fix: resolve timezone offset issue in edit modal date display - #25

Merged
dh1011 merged 1 commit into
mainfrom
fix/date-offset-in-edit-modal
Feb 2, 2026
Merged

fix: resolve timezone offset issue in edit modal date display#25
dh1011 merged 1 commit into
mainfrom
fix/date-offset-in-edit-modal

Conversation

@dh1011

@dh1011 dh1011 commented Feb 2, 2026

Copy link
Copy Markdown
Owner

Summary

  • Fixes timezone offset bug where dates in the edit modal displayed one day earlier than expected
  • Replaced new Date() with parseISO() from date-fns for proper ISO 8601 date parsing
  • All API tests passing (11/11)

Problem

When editing a subscription, the date would show correctly in the list and calendar but appear one day earlier in the edit modal. For example, a subscription saved on the 15th would show as the 14th when reopened for editing.

Root Cause

The date string from the database (e.g., "2024-02-15") was being parsed with new Date(), which interprets it as UTC midnight. In timezones behind UTC (like EST/UTC-5), this caused the date to shift backward by one day when displayed in the user's local timezone.

Solution

Used parseISO() from the date-fns library (already in use elsewhere in the codebase) which properly handles ISO 8601 date strings without timezone interpretation issues.

Testing

  • ✅ Built and ran podman container successfully
  • ✅ All 11 API tests passed
  • ✅ Ready for GUI verification

Files Changed

  • src/components/SubscriptionModal.tsx: Added parseISO import and replaced Date constructor calls

When editing a subscription, the date in the modal was displaying one
day earlier than expected. This occurred because the date string from
the database (e.g., "2024-02-15") was being parsed with new Date(),
which interprets it as UTC midnight. In timezones behind UTC (like EST),
this caused the date to shift backward by one day when displayed in the
user's local timezone.

Fixed by replacing new Date() with parseISO() from date-fns, which
properly handles ISO 8601 date strings without timezone interpretation
issues. This matches the pattern already used in other components like
CalendarGrid.tsx.

Fixes issue where dates show correctly in the list and map but appear
one day earlier in the edit modal.
@dh1011
dh1011 merged commit edf40f5 into main Feb 2, 2026
1 check passed
@dh1011
dh1011 deleted the fix/date-offset-in-edit-modal branch February 2, 2026 05:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant