Files
accounted/extensions/general
Jakob Wennberg 11400b4dec fix(banking): base sync date suggestions on booked coverage and the real fiscal period (#956)
* fix(enable-banking): base sync date suggestions on booked coverage and actual fiscal period

The "start after your bookkeeping" suggestion in the account picker now
uses the latest posted verifikat date (journal_entries, status posted)
instead of sie_imports.fiscal_year_end: the fiscal period end can lie
months past the last actually booked transaction, so the old suggestion
made users skip every unbooked transaction in between. Companies with
no posted entries get no suggestion instead of a misleading one.

The suggested start date (day after the last posted verifikat) is
clamped to today (UTC): the PATCH handler rejects non-past
initial_lookback_from_date values, so a company whose latest verifikat
is dated today would otherwise be suggested tomorrow and get a 400 when
saving.

"Sedan raekenskapsaarets boerjan" now resolves from the fiscal_periods
row containing today, falling back to the recurring
fiscal_year_start_month setting only when no period row exists, so an
extended or shortened first fiscal year (e.g. 2025-10-01 to 2026-12-31)
resolves to its real start date instead of the recurring-year date.

Date logic extracted to lib/date-suggestions.ts with regression tests
covering both issue scenarios.

Fixes #917

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix(banking): keep the fiscal-year date masked when the settings fetch fails (CodeRabbit)

A failed company_settings or fiscal_periods query silently fell back to
the calendar-year default, the exact misleading suggestion issue #917
removes. On error the date now stays masked and the request-side
fallback remains the recurring-setting derivation.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-09 21:20:24 +02:00
..
2026-07-05 03:05:09 +02:00