-
Notifications
You must be signed in to change notification settings - Fork 11
Fix launchDesk #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Dilshan Madusanka (madudilshan47-dot)
wants to merge
11
commits into
codezelaca:main
Choose a base branch
from
madudilshan47-dot:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
0e0053d
Fix :Storage Key problem
madudilshan47-dot ec07c60
Fix :Typo in Event Listener
madudilshan47-dot 072b32a
Fix :Validation problem
madudilshan47-dot b8598e2
Fix :Form Submit Event Bug
madudilshan47-dot d06e98a
Fix :Status Filter Bug
madudilshan47-dot 17d8108
Fix :CSS Class Bug
madudilshan47-dot 20078cc
Fix :Due Soon Count Bug
madudilshan47-dot d6800f1
Fix :Delete Button Bug
madudilshan47-dot f130c9d
Fix :Status Change Bug
madudilshan47-dot ddbaeee
Fix :Reset Demo Data Bug
madudilshan47-dot d5c14d4
Fix :CSV Export Bug
madudilshan47-dot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🌐 Web query:
In ECMAScript, doesnew Date("2026-05-10")parse as UTC or local time, and what is the recommended way to avoid off-by-one day errors when computing day differences againstnew Date()?💡 Result:
new Date("2026-05-10")is parsed as UTC midnight (2026-05-10T00:00:00Z), not local time. [1] So the Date object represents an instant at the start of the UTC day; when you display it using local-time getters/formatters (e.g.,toString(),getFullYear(), etc.), it may appear as the previous day in time zones west of UTC (off-by-one in the display layer). 2) Recommended way to avoid off-by-one day errors when computing day differences vsnew Date()For “calendar day” differences, don’t subtract raw timestamps coming from mixed origins/normalizations. Instead, normalize both sides to a consistent day boundary in the domain you care about (UTC for global/backend logic, or a specific IANA time zone via a library/Temporal). If you want UTC-based day differences using ISO date-only strings, parse them as UTC and then compute using UTC midnight: const start = new Date('2026-05-10T00:00:00Z'); const end = new Date; // Normalize end to UTC midnight too end.setUTCHours(0, 0, 0, 0); const msPerDay = 24 * 60 * 60 * 1000; const diffDays = Math.round((end - start) / msPerDay); Why this helps:Datemath is based on instants (timestamps), while “day differences” are usually about calendar days; UTC avoids DST-length day problems because UTC days are always 86,400,000 ms, and normalization prevents partial-day values from producing 0.99/1.01 day rounding errors. [2][3] If you instead need “local calendar day” differences, normalize both dates using local midnight (viasetHours(0,0,0,0)), or better, use an explicit time zone library rather than relying on environment locale/timezone rules. Sources: [1] MDN Date page explains: when timezone offset is absent, date-only forms are interpreted as a UTC time (with a historical spec compatibility note). [3] ECMAScript spec defines time values relative to UTC days and 86,400,000 ms per day boundaries. [2] Synyx article explains DST/day-length issues and that UTC avoids those problems for “how many days” calculations.Citations:
🏁 Script executed:
Repository: codezelaca/fs-se-debugging-bugs
Length of output: 85
🏁 Script executed:
Repository: codezelaca/fs-se-debugging-bugs
Length of output: 89
🏁 Script executed:
Repository: codezelaca/fs-se-debugging-bugs
Length of output: 701
🏁 Script executed:
rg "function daysUntil|const daysUntil" js/app.js -A 6Repository: codezelaca/fs-se-debugging-bugs
Length of output: 276
Normalize day math before
dueSoonbucketing.The
daysUntil()function comparesnew Date(dateValue)(which parses ISO strings like"2026-05-10"as UTC midnight) againstnew Date()(which uses local time). This timezone mismatch causes incorrect day-difference calculations, producing off-by-one counts near the 0 and 7-day boundaries depending on the local timezone and time of day.Normalize both dates to local midnight before computing the difference:
Suggested fix
function daysUntil(dateValue) { - const today = new Date(); - const target = new Date(dateValue); - const difference = target.getTime() - today.getTime(); - return Math.ceil(difference / 86400000); + if (!dateValue) return Number.POSITIVE_INFINITY; + + const now = new Date(); + const today = new Date(now.getFullYear(), now.getMonth(), now.getDate()); + + const [year, month, day] = String(dateValue).split("-").map(Number); + const target = new Date(year, month - 1, day); + + return Math.floor((target.getTime() - today.getTime()) / 86400000); }🤖 Prompt for AI Agents