[PR #7057] Fix skipping schedules that move before weekend #6909

Open
opened 2026-02-28 21:34:20 -06:00 by GiteaMirror · 0 comments
Owner

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

State: open
Merged: No


Description

In short the current logic moves the day forward by one, but then during the getDateWithSkippedWeekend function if it is a move before weekend schedule the date is pushed back to Friday. Then causing the resulting setNextDate to do nothing, since the two dates are the same. Example:

  1. Scheduled date is supposed to be 15th, but this month 15th is Saturday, schedule is set to move before weekend. So schedule date is 14th.
  2. User wants to skip the occurrence. So the hit skip button.
  3. The skip function adds one day, pushing the 14th to the 15th. Pushing the date back to Saturday the 15th.
  4. When looking for future or activate occurrences, the next one is the current one (because the 15th matches the 15th
  5. Then to ensure the new next date follows the move before weekend the date is moved back to the 14th (because the 15th is a Saturday).
  6. Lastly during the comparison of the processed date and the current schedule date both values are the same so the schedule isn't skipped.

The fix leaves the original behaviour for all schedules except ones that move before the weekend and only when coming from the skip path. It pushes the days past the weekend, so when looking for future occurrences it doesn't find itself.

Fixes #6270

Testing

Reproduction steps are in issue#6270. In short make a repeating schedule that moves days before the weekend and then try to skip that schedule it fails on master but succeeds here.

I also added some tests to ensure skipping works properly, so you could copy just the test changes to validate the failures on main.

Test File:
schedule-skipping-before-weekend-test.zip

Checklist

  • Release notes added (see link above)
  • No obvious regressions in affected areas
  • Self-review has been performed - I understand what each change in the code does and why it is needed

Bundle Stats

Bundle Files count Total bundle size % Changed
desktop-client 27 14.85 MB 0%
loot-core 1 5.82 MB → 5.82 MB (+1.08 kB) +0.02%
api 1 4.43 MB → 4.43 MB (+957 B) +0.02%
View detailed bundle stats

desktop-client

Total

Files count Total bundle size % Changed
27 14.85 MB 0%
View detailed bundle breakdown

Added
No assets were added

Removed
No assets were removed

Bigger
No assets were bigger

Smaller
No assets were smaller

Unchanged

Asset File Size % Changed
static/js/index.js 9.54 MB 0%
static/js/indexeddb-main-thread-worker-e59fee74.js 12.94 kB 0%
static/js/workbox-window.prod.es5.js 5.64 kB 0%
static/js/ca.js 188.15 kB 0%
static/js/da.js 106.35 kB 0%
static/js/de.js 180.07 kB 0%
static/js/en-GB.js 7.18 kB 0%
static/js/en.js 170.37 kB 0%
static/js/es.js 174.55 kB 0%
static/js/fr.js 179.6 kB 0%
static/js/it.js 171.16 kB 0%
static/js/nb-NO.js 156.96 kB 0%
static/js/nl.js 106.37 kB 0%
static/js/pl.js 88.37 kB 0%
static/js/pt-BR.js 154.22 kB 0%
static/js/th.js 181.87 kB 0%
static/js/uk.js 214.74 kB 0%
static/js/resize-observer.js 18.37 kB 0%
static/js/BackgroundImage.js 120.54 kB 0%
static/js/ReportRouter.js 1.16 MB 0%
static/js/narrow.js 637.77 kB 0%
static/js/TransactionList.js 106.22 kB 0%
static/js/wide.js 164.15 kB 0%
static/js/AppliedFilters.js 9.71 kB 0%
static/js/usePayeeRuleCounts.js 10.04 kB 0%
static/js/useTransactionBatchActions.js 13.23 kB 0%
static/js/FormulaEditor.js 1.04 MB 0%

loot-core

Total

Files count Total bundle size % Changed
1 5.82 MB → 5.82 MB (+1.08 kB) +0.02%
Changeset
File Δ Size
node_modules/date-fns/isFriday.js 🆕 +603 B 0 B → 603 B
home/runner/work/actual/actual/packages/loot-core/src/server/schedules/app.ts 📈 +498 B (+3.83%) 12.71 kB → 13.19 kB
View detailed bundle breakdown

Added

Asset File Size % Changed
kcab.worker.Di5cUOmw.js 0 B → 5.82 MB (+5.82 MB) -

Removed

Asset File Size % Changed
kcab.worker.BwrdDDMW.js 5.82 MB → 0 B (-5.82 MB) -100%

Bigger
No assets were bigger

Smaller
No assets were smaller

Unchanged
No assets were unchanged


api

Total

Files count Total bundle size % Changed
1 4.43 MB → 4.43 MB (+957 B) +0.02%
Changeset
File Δ Size
node_modules/date-fns/isFriday.js 🆕 +507 B 0 B → 507 B
src/server/schedules/app.ts 📈 +450 B (+4.00%) 11 kB → 11.44 kB
View detailed bundle breakdown

Added
No assets were added

Removed
No assets were removed

Bigger

Asset File Size % Changed
bundle.api.js 4.43 MB → 4.43 MB (+957 B) +0.02%

Smaller
No assets were smaller

Unchanged
No assets were unchanged

**Original Pull Request:** https://github.com/actualbudget/actual/pull/7057 **State:** open **Merged:** No --- <!-- Thank you for submitting a pull request! Make sure to follow the instructions to write release notes for your PR — it should only take a minute or two: https://github.com/actualbudget/docs#writing-good-release-notes. Try running yarn generate:release-notes *before* pushing your PR for an interactive experience. --> ## Description In short the current logic moves the day forward by one, but then during the getDateWithSkippedWeekend function if it is a move before weekend schedule the date is pushed back to Friday. Then causing the resulting setNextDate to do nothing, since the two dates are the same. Example: 1. Scheduled date is supposed to be 15th, but this month 15th is Saturday, schedule is set to move before weekend. So schedule date is 14th. 2. User wants to skip the occurrence. So the hit skip button. 3. The [skip function adds one day, pushing the 14th to the 15th](https://github.com/actualbudget/actual/blob/master/packages/loot-core/src/server/schedules/app.ts#L331). Pushing the date back to Saturday the 15th. 4. When [looking for future or activate occurrences, the next one is the current one (because the 15th matches the 15th](https://github.com/actualbudget/actual/blob/master/packages/loot-core/src/shared/schedules.ts#L358) 5. Then to ensure the `new next` date follows the move before weekend the [date is moved back to the 14th (because the 15th is a Saturday)](https://github.com/actualbudget/actual/blob/master/packages/loot-core/src/shared/schedules.ts#L388). 6. Lastly [during the comparison of the `processed date` and the `current schedule date`](https://github.com/actualbudget/actual/blob/master/packages/loot-core/src/server/schedules/app.ts#L141) both values are the same so the schedule isn't skipped. The fix leaves the original behaviour for all schedules except ones that move before the weekend and only when coming from the skip path. It pushes the days past the weekend, so when looking for future occurrences it doesn't find itself. ## Related issue(s) Fixes #6270 ## Testing Reproduction steps are in [issue#6270](https://github.com/actualbudget/actual/issues/6270). In short make a repeating schedule that moves days before the weekend and then try to skip that schedule it fails on master but succeeds here. I also added some tests to ensure skipping works properly, so you could copy just the test changes to validate the failures on main. Test File: [schedule-skipping-before-weekend-test.zip](https://github.com/user-attachments/files/25475822/schedule-skipping-before-weekend-test.zip) ## Checklist - [x] Release notes added (see link above) - [x] No obvious regressions in affected areas - [x] Self-review has been performed - I understand what each change in the code does and why it is needed <!--- actual-bot-sections ---> <!--- bundlestats-action-comment key:combined start ---> ### Bundle Stats Bundle | Files count | Total bundle size | % Changed ------ | ----------- | ----------------- | --------- desktop-client | 27 | 14.85 MB | 0% loot-core | 1 | 5.82 MB → 5.82 MB (+1.08 kB) | +0.02% api | 1 | 4.43 MB → 4.43 MB (+957 B) | +0.02% <details> <summary>View detailed bundle stats</summary> #### desktop-client **Total** Files count | Total bundle size | % Changed ----------- | ----------------- | --------- 27 | 14.85 MB | 0% <details> <summary>View detailed bundle breakdown</summary> <div> **Added** No assets were added **Removed** No assets were removed **Bigger** No assets were bigger **Smaller** No assets were smaller **Unchanged** Asset | File Size | % Changed ----- | --------- | --------- static/js/index.js | 9.54 MB | 0% static/js/indexeddb-main-thread-worker-e59fee74.js | 12.94 kB | 0% static/js/workbox-window.prod.es5.js | 5.64 kB | 0% static/js/ca.js | 188.15 kB | 0% static/js/da.js | 106.35 kB | 0% static/js/de.js | 180.07 kB | 0% static/js/en-GB.js | 7.18 kB | 0% static/js/en.js | 170.37 kB | 0% static/js/es.js | 174.55 kB | 0% static/js/fr.js | 179.6 kB | 0% static/js/it.js | 171.16 kB | 0% static/js/nb-NO.js | 156.96 kB | 0% static/js/nl.js | 106.37 kB | 0% static/js/pl.js | 88.37 kB | 0% static/js/pt-BR.js | 154.22 kB | 0% static/js/th.js | 181.87 kB | 0% static/js/uk.js | 214.74 kB | 0% static/js/resize-observer.js | 18.37 kB | 0% static/js/BackgroundImage.js | 120.54 kB | 0% static/js/ReportRouter.js | 1.16 MB | 0% static/js/narrow.js | 637.77 kB | 0% static/js/TransactionList.js | 106.22 kB | 0% static/js/wide.js | 164.15 kB | 0% static/js/AppliedFilters.js | 9.71 kB | 0% static/js/usePayeeRuleCounts.js | 10.04 kB | 0% static/js/useTransactionBatchActions.js | 13.23 kB | 0% static/js/FormulaEditor.js | 1.04 MB | 0% </div> </details> --- #### loot-core **Total** Files count | Total bundle size | % Changed ----------- | ----------------- | --------- 1 | 5.82 MB → 5.82 MB (+1.08 kB) | +0.02% <details> <summary>Changeset</summary> File | Δ | Size ---- | - | ---- `node_modules/date-fns/isFriday.js` | 🆕 +603 B | 0 B → 603 B `home/runner/work/actual/actual/packages/loot-core/src/server/schedules/app.ts` | 📈 +498 B (+3.83%) | 12.71 kB → 13.19 kB </details> <details> <summary>View detailed bundle breakdown</summary> <div> **Added** Asset | File Size | % Changed ----- | --------- | --------- kcab.worker.Di5cUOmw.js | 0 B → 5.82 MB (+5.82 MB) | - **Removed** Asset | File Size | % Changed ----- | --------- | --------- kcab.worker.BwrdDDMW.js | 5.82 MB → 0 B (-5.82 MB) | -100% **Bigger** No assets were bigger **Smaller** No assets were smaller **Unchanged** No assets were unchanged </div> </details> --- #### api **Total** Files count | Total bundle size | % Changed ----------- | ----------------- | --------- 1 | 4.43 MB → 4.43 MB (+957 B) | +0.02% <details> <summary>Changeset</summary> File | Δ | Size ---- | - | ---- `node_modules/date-fns/isFriday.js` | 🆕 +507 B | 0 B → 507 B `src/server/schedules/app.ts` | 📈 +450 B (+4.00%) | 11 kB → 11.44 kB </details> <details> <summary>View detailed bundle breakdown</summary> <div> **Added** No assets were added **Removed** No assets were removed **Bigger** Asset | File Size | % Changed ----- | --------- | --------- bundle.api.js | 4.43 MB → 4.43 MB (+957 B) | +0.02% **Smaller** No assets were smaller **Unchanged** No assets were unchanged </div> </details> </details> <!--- bundlestats-action-comment key:combined end --->
GiteaMirror added the pull-request label 2026-02-28 21:34:20 -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#6909