Skip to content

fix: resolve timezone shifting bug in Todo deadline #488#527

Open
Ranjana-git7 wants to merge 1 commit into
lovelymahor:mainfrom
Ranjana-git7:fix/issue-488-todo-timezone
Open

fix: resolve timezone shifting bug in Todo deadline #488#527
Ranjana-git7 wants to merge 1 commit into
lovelymahor:mainfrom
Ranjana-git7:fix/issue-488-todo-timezone

Conversation

@Ranjana-git7

Copy link
Copy Markdown

Fixes #488

Problem

The datetime-local input in the Todo form displayed the deadline using .toISOString().slice(0,16), which converts the stored time to UTC. Since datetime-local inputs expect a local time string (no timezone info), this caused the displayed time to shift backward by the local timezone offset (e.g., 5.5 hours for GMT+5:30). Saving this shifted value repeatedly caused the deadline to drift further back on every edit.

Fix

Added a toLocalDatetimeInputValue() helper function that converts the stored UTC ISO timestamp back to the correct local time for display in the datetime-local input, compensating for the timezone offset. The save logic (new Date(value).toISOString()) was already correct and required no change.

Changes

  • Added toLocalDatetimeInputValue(iso) helper in Todo.js
  • Updated the datetime-local input's value prop to use this helper instead of .toISOString().slice(0,16)

Testing

  • Created a task with a specific deadline time
  • Edited the task and confirmed the displayed time matches the original (no shift)
  • Saved and re-edited multiple times — deadline remains stable, no cumulative drift

Note

Existing unrelated build errors in Navbar.css, Home.js, and Profile.js were present on main before this change and are out of scope for this PR.

@vercel

vercel Bot commented Jun 13, 2026

Copy link
Copy Markdown

@Ranjana-git7 is attempting to deploy a commit to the Lovely Mahour's projects Team on Vercel.

A member of the Team first needs to authorize it.

@Ranjana-git7 Ranjana-git7 changed the title fix: resolve timezone shifting bug in Todo deadline (#488) fix: resolve timezone shifting bug in Todo deadline #488 Jun 13, 2026
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.

Bug : Deadline Timezone Shifting in To-Do List

1 participant