Fix calendar grid alignment when doesn't start on Monday#76
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughThis PR fixes calendar month grid alignment when WordPress "Week Starts On" is configured to a value other than Monday. The 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/classes/class-se-calendar.php`:
- Line 448: Update the `@param` docblock for $start_of_week in
class-se-calendar.php: change the type from "int" to "integer" and start the
parameter description with a capital letter or rephrase it (for example:
"WordPress `start_of_week` option: 0 = Sunday through 6 = Saturday.") so the
comment begins with a capitalized word and satisfies PHPCS.
- Line 469: Update the docblock for the parameter $start_of_week in the
SE_Calendar class (where the `@param` currently reads "int $start_of_week
`start_of_week` option: 0 = Sunday through 6 = Saturday.") to use the word
"integer" instead of "int" and start the parameter description with a capital
letter (e.g., "Start_of_week `start_of_week` option: ..." or better "Start of
week `start_of_week` option: ..."), ensuring the `@param` line reads "`@param`
integer $start_of_week Start of week `start_of_week` option: 0 = Sunday through
6 = Saturday." to satisfy PHPCS.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 9311a45b-4033-451e-bcf4-681c527aa9bc
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (4)
README.mdpackage.jsonplugin.phpsrc/classes/class-se-calendar.php
This issue is live on https://thepocketnyc.com/calendar/grid/
Changes proposed in this Pull Request
get_start_day()andget_end_day()inclass-se-calendar.phpso the month grid respects WordPressstart_of_weekfor all values (0–6), not just Monday.abs(1 - w)/7 - w) with( w - start_of_week + 7 ) % 7so dates appear under the correct weekday column.Before: With Week Starts On → Sunday, a month whose 1st falls on Monday (e.g. June 2026) showed the 1st under the Sunday column — headers were correct but dates were shifted.
After: Grid cells align with weekday headers for both Sunday and Monday week starts.
Correct:
Incorrect:
June 9, 26 is a not a Monday.
Testing instructions
Sunday week start (
start_of_week = 0)Monday week start (
start_of_week = 1)Month navigation
Mentions #
@gin0115 @tommusrhodus
Summary by CodeRabbit
Bug Fixes
Chores
Documentation