fix: resolve timezone shifting bug in Todo deadline #488#527
Open
Ranjana-git7 wants to merge 1 commit into
Open
fix: resolve timezone shifting bug in Todo deadline #488#527Ranjana-git7 wants to merge 1 commit into
Ranjana-git7 wants to merge 1 commit into
Conversation
|
@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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #488
Problem
The
datetime-localinput in the Todo form displayed the deadline using.toISOString().slice(0,16), which converts the stored time to UTC. Sincedatetime-localinputs 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 thedatetime-localinput, compensating for the timezone offset. The save logic (new Date(value).toISOString()) was already correct and required no change.Changes
toLocalDatetimeInputValue(iso)helper inTodo.jsdatetime-localinput'svalueprop to use this helper instead of.toISOString().slice(0,16)Testing
Note
Existing unrelated build errors in
Navbar.css,Home.js, andProfile.jswere present onmainbefore this change and are out of scope for this PR.