Fix period initialisation order so first expense line date defaults correctly

state.periodFrom was set inside render(), after newItem() was called,
so the first line always got an empty date. Setting the period before
pushing the first item ensures the default date is the period start.

https://claude.ai/code/session_01MbwfxnjLA9KdFTrfzB55HM
This commit is contained in:
Claude 2026-05-24 16:54:38 +00:00
parent f1be8fde1b
commit 0c7bb8ac91
No known key found for this signature in database

View file

@ -1017,6 +1017,9 @@ async function init() {
try {
await loadConfig();
state.baseCurrency = CFG['currency-base'];
const p = defaultPeriod();
state.periodFrom = p.from;
state.periodTo = p.to;
state.items.push(newItem());
render();
} catch (e) {