Skip to content

fix: show correct day for deadlines in every timezone - #23

Merged
abhishekgoswami0720 merged 3 commits into
LetsCook-Organization:mainfrom
abhinna123:fix/issue-8-deadline-countdown
Nov 11, 2026
Merged

abhishekgoswami0720 merged 3 commits into
LetsCook-Organization:mainfrom
abhinna123:fix/issue-8-deadline-countdown

Conversation

@abhinna123

@abhinna123 abhinna123 commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

🌌 Pull Request Summary

Description

Goal and project deadline countdowns could be one day off depending on the viewer’s timezone and time of day. This PR uses local calendar days for consistent countdowns.

The shared daysUntil(dateStr) helper validates date-only strings and ISO timestamps, returns the whole-day difference from today in the local calendar, and returns null for missing or invalid dates. formatDaysUntil() provides consistent countdown wording.

Home’s Dashboard, Goals, and Projects now use these helpers. Finished goals retain their “Finished • was due” label, and finished projects with past target dates now show the same kind of label instead of an active “days late” countdown.

Added date tests cover today, tomorrow, yesterday, multiple days overdue, future dates, missing and malformed dates, month-end and year-end, leap days, timezone offsets, and daylight-saving transitions. Added an Unreleased entry to CHANGELOG.md.

Fixes #8


Type of Change

  • Bug fix (non-breaking change resolving an unexpected behavior or error)
  • New feature
  • UI / UX enhancement
  • Documentation
  • Refactoring
  • Performance optimization

How Has This Been Tested?

  • Browser Testing: Opened the app locally and checked Home, Goals, and Projects. Verified today, tomorrow, yesterday, overdue, future, and completed-item labels.
  • Zero Console Errors: Console logs were not available through the browser interface used for testing.
  • LocalStorage Integrity: Sample data and test goals persisted after reload; the passing storage tests also verify valid existing data is preserved.
  • Responsive Design: Desktop, tablet, and mobile breakpoints were not checked.
  • Accessibility: Keyboard navigation and dialog behavior were not checked.

Automated checks:

  • npm run check — passed: ESLint, Prettier, and 101/101 tests in Asia/Kolkata, UTC, America/Los_Angeles, and Pacific/Kiritimati.

Contributor Checklist

  • My code adheres to the project's vanilla standards (HTML5, CSS3, ES6+ modules; zero heavy frontend frameworks or build steps).
  • I have read and followed the Contributing Guidelines. Pending: document the shared date-helper call paths in docs/FLOW.md.
  • I have performed a self-review of my own code.
  • I have preserved all existing unrelated code, docstrings, and comments.
  • Saved or typed text put into HTML goes through escapeHTML(), and links through safeUrl(), to prevent XSS.
  • Words on screen are plain, and stored values are shown through the label helpers rather than changed.
  • APP_FILES and CACHE_VERSION are unchanged (not applicable: no app files were added, removed, or renamed).
  • I have updated corresponding documentation if my changes modify existing features or settings. Pending: docs/FLOW.md does not yet describe the new helper call paths.
  • npm run check passes locally.
  • If this PR changes something users can see or do, I added a line under Unreleased in CHANGELOG.md.
  • If this PR makes a design choice (new library, data-shape change, trade-off), I added an entry to docs/DECISIONS.md. Not applicable: no new library, data shape, or architectural trade-off was introduced.
  • If this PR changes which function calls which, or the startup order, I updated docs/FLOW.md. Pending: the new calls from the page renderers to the shared date helpers are not documented there.

@abhinna123

Copy link
Copy Markdown
Contributor Author

Hi maintainers,

I’ve completed the fix for Issue #8 and updated the documentation in docs/FLOW.md as well.

The latest changes have been pushed to PR #23. However, GitHub Actions appears to require workflow approval before CI checks can run.

Could a maintainer please review the PR and approve the workflow run?

Thank you!

@abhishekgoswami0720 abhishekgoswami0720 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a really clean first PR, @abhinna123. Thank you! 🎉

What I liked:

  • One shared helper instead of three copies of the date math
  • Tests for exactly the cases that broke (early morning IST, late evening PST, DST, leap day)
  • You also caught the "1 days left" plural bug

Two small notes, no changes needed for this PR:

  • daysUntil() takes the date part of a full timestamp as written, so the timezone offset is ignored. That's fine today because deadlines are saved as plain dates. Worth knowing if it's ever used for timestamps.
  • Could you tick the CONTRIBUTING and FLOW.md boxes in the PR description? You did both in your last commit.

Approving and merging. Welcome to CodeOrbit! When you're ready for a next one, the help wanted issues are open to you. #14 (keeping focus inside dialogs) would be a good step up.

@abhishekgoswami0720
abhishekgoswami0720 merged commit dfe5e3b into LetsCook-Organization:main Nov 11, 2026
3 checks passed
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.

"Days left" on goals and projects can be one day off, depending on timezone and time of day

2 participants