FU10: localize energy time math to server tz; accrue fixed/credit per elapsed local day
- Store UTC, compute day boundaries in server local timezone (new app/services/timezone.py). - summarize: fixed fee / tax credit accrue only for elapsed whole local days, integrated across contract versions — no future-day inflation, no version-switch collapse. - MQTT import_cost_total / export_revenue_total getters delegate to summarize (no inline apportionment), anchored at the active contract's earliest version effective_from so the total sensors stay monotonic and never jump backward. - effective_from: naive datetimes interpreted as server-local wall-clock, then stored UTC. - frontend ContractForm sends local-midnight naive datetime (was UTC midnight). - get_costs_summary default window uses server-local "today".
This commit is contained in:
@@ -218,9 +218,13 @@ export function ContractForm({ contractId, defaultKind, onClose, onSaved }: Cont
|
||||
const values = buildNestedValues(sectionFields, fieldValues)
|
||||
|
||||
try {
|
||||
// Convert local date string to ISO datetime if provided
|
||||
// Convert local date string to a naive local-midnight datetime string (no Z).
|
||||
// The backend interprets naive datetimes as server local wall-clock time,
|
||||
// so "2026-06-25T00:00:00" → CEST local midnight → stored as UTC 22:00Z.
|
||||
// When effectiveFromStr is empty, fall back to the current instant (aware,
|
||||
// sent as ISO with Z) so the backend stores it unchanged.
|
||||
const effectiveFromISO = effectiveFromStr
|
||||
? new Date(effectiveFromStr).toISOString()
|
||||
? `${effectiveFromStr}T00:00:00`
|
||||
: undefined
|
||||
|
||||
if (isAddVersion) {
|
||||
|
||||
Reference in New Issue
Block a user