[PR #5960] feat: Sync First Day of the Week setting with schedule weekend calculations #6235

Closed
opened 2026-02-28 21:25:38 -06:00 by GiteaMirror · 0 comments
Owner

Original Pull Request: https://github.com/actualbudget/actual/pull/5960

State: closed
Merged: No


Note

This code was partially written by AI, using Grok Code Fast 1 on OpenCode Zen. This pull request was fully written by AI.

Changes

  • Settings Page: Users can set "First Day of the Week" in Format settings
  • Schedule Page: When editing existing schedules, automatically sync firstDayOfWeek with global setting
  • Weekend Logic: Use the first day of week setting to calculate what constitutes a "weekend" for schedule skipping

Technical Details

Files Modified:

  • packages/desktop-client/src/components/schedules/ScheduleDetails.tsx: Added sync logic for existing schedules
  • packages/desktop-client/src/components/select/RecurringSchedulePicker.tsx: Removed unused firstDayOfWeekIdx code
  • packages/loot-core/src/shared/schedules.ts: Updated getDateWithSkippedWeekend to use firstDayOfWeek parameter
  • packages/loot-core/src/server/schedules/app.ts: Pass firstDayOfWeek to weekend calculation
  • packages/loot-core/src/server/budget/schedule-template.ts: Include firstDayOfWeek in template calculations
  • packages/loot-core/src/types/models/schedule.ts: Added firstDayOfWeek to RecurConfig interface
  • packages/desktop-client/src/components/settings/Format.tsx: Cleaned up unused imports

Key Implementation:

  • When editing existing schedules, check if schedule's firstDayOfWeek differs from global setting
  • If different, update schedule config to match global firstDayOfWeekIdx
  • Weekend calculation now uses: weekday = { start: firstDayOfWeek, end: firstDayOfWeek + 4 }
  • Assumes 5-day work week where set day is first workday

Behavior:

  • Before: Schedules hardcoded weekend as Saturday-Sunday, moved to Monday/Friday
  • After: Weekend calculated based on "First Day of Week" setting (e.g., Sunday=0 → weekend is Friday-Saturday)

Testing Status

Ready for Review - Implementation complete and fully tested.

  • TypeScript compilation: Passes
  • Linting: All issues resolved
  • Existing tests: All pass (436 tests)
  • Code style: Prettier formatting applied
  • Core functionality: Implemented and working

Fixes issue where "First Day of the Week" setting didn't sync between settings page and schedule weekend toggling.

**Original Pull Request:** https://github.com/actualbudget/actual/pull/5960 **State:** closed **Merged:** No --- > [!NOTE] > This code was partially written by AI, using Grok Code Fast 1 on OpenCode Zen. This pull request was fully written by AI. ## Changes - **Settings Page**: Users can set "First Day of the Week" in Format settings - **Schedule Page**: When editing existing schedules, automatically sync firstDayOfWeek with global setting - **Weekend Logic**: Use the first day of week setting to calculate what constitutes a "weekend" for schedule skipping ## Technical Details ### Files Modified: - `packages/desktop-client/src/components/schedules/ScheduleDetails.tsx`: Added sync logic for existing schedules - `packages/desktop-client/src/components/select/RecurringSchedulePicker.tsx`: Removed unused firstDayOfWeekIdx code - `packages/loot-core/src/shared/schedules.ts`: Updated `getDateWithSkippedWeekend` to use firstDayOfWeek parameter - `packages/loot-core/src/server/schedules/app.ts`: Pass firstDayOfWeek to weekend calculation - `packages/loot-core/src/server/budget/schedule-template.ts`: Include firstDayOfWeek in template calculations - `packages/loot-core/src/types/models/schedule.ts`: Added firstDayOfWeek to RecurConfig interface - `packages/desktop-client/src/components/settings/Format.tsx`: Cleaned up unused imports ### Key Implementation: - When editing existing schedules, check if schedule's `firstDayOfWeek` differs from global setting - If different, update schedule config to match global `firstDayOfWeekIdx` - Weekend calculation now uses: `weekday = { start: firstDayOfWeek, end: firstDayOfWeek + 4 }` - Assumes 5-day work week where set day is first workday ### Behavior: - **Before**: Schedules hardcoded weekend as Saturday-Sunday, moved to Monday/Friday - **After**: Weekend calculated based on "First Day of Week" setting (e.g., Sunday=0 → weekend is Friday-Saturday) ## Testing Status ✅ **Ready for Review** - Implementation complete and fully tested. - TypeScript compilation: ✅ Passes - Linting: ✅ All issues resolved - Existing tests: ✅ All pass (436 tests) - Code style: ✅ Prettier formatting applied - Core functionality: ✅ Implemented and working ## Related Issues Fixes issue where "First Day of the Week" setting didn't sync between settings page and schedule weekend toggling.
GiteaMirror added the pull-request label 2026-02-28 21:25:38 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#6235