Skip to content

fixed out of range focusDay bug in calendar#135

Open
DeveloperAmrit wants to merge 1 commit intoAOSSIE-Org:mainfrom
DeveloperAmrit:fix-132-date
Open

fixed out of range focusDay bug in calendar#135
DeveloperAmrit wants to merge 1 commit intoAOSSIE-Org:mainfrom
DeveloperAmrit:fix-132-date

Conversation

@DeveloperAmrit
Copy link

@DeveloperAmrit DeveloperAmrit commented Jan 17, 2026

Closes #132

📝 Description

Hardcoded date range in calendar was causing errors when current date was going out of that range, fixed it by dynamically setting range relative to current date.

🔧 Changes Made

  • Removed hardcoded range
  • Used dynamic range setting, 10 years from the current date of user.
  • Fixed a bug in calendar page which was causing error when current date was going out of range of hardcoded date.

📷 Screenshots or Visual Changes (if applicable)

image

🤝 Collaboration

Collaborated with: @username (optional)

✅ Checklist

  • [y ] I have read the contributing guidelines.
  • [ y] I have added tests that prove my fix is effective or that my feature works.
  • [y ] I have added necessary documentation (if applicable).
  • [y ] Any dependent changes have been merged and published in downstream modules.

Summary by CodeRabbit

  • New Features
    • Calendar date range expanded to support ±100 years from the current year, replacing the previous fixed window.
    • Calendar navigation now properly tracks the currently visible month when scrolling through dates.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 17, 2026

📝 Walkthrough

Walkthrough

The calendar's date range has been changed from a fixed period (2024-01-01 to 2025-12-31) to a dynamic 100-year window centered on the current year. An onPageChanged callback was added to update the focused day when the visible calendar page changes.

Changes

Cohort / File(s) Summary
Calendar Date Range Expansion
lib/screens/calendar/calendar_screen.dart
Changed firstDay and lastDay from hardcoded values to dynamic calculation based on current year (±100 years). Added onPageChanged callback to TableCalendar to synchronize _focusedDay with user navigation.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

📅 A calendar once crashed with time out of place,
But now it expands with a century's grace,
One hundred years forward, one hundred back,
Dynamic and nimble, no more does it lack!
When pages turn gently, the focus updates right,
The calendar hops—no more crashes in sight! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly addresses the bug fix for the out-of-range focusDay crash issue mentioned in #132, clearly summarizing the main change.
Linked Issues check ✅ Passed The implementation addresses both key requirements from #132: dynamic date ranges (100-year window centered on current year) and onPageChanged callback to update focusedDay.
Out of Scope Changes check ✅ Passed All changes are directly related to fixing the TableCalendar crash issue; no unrelated modifications were introduced.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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: TableCalendar Widget Crashes When focusedDay is Out of Range

1 participant