Skip to main content

Legal dates are stamped from click time

Several legally significant dates — the ones that anchor statutory deadlines — are set to now() at the moment a user clicks "advance phase", inside useWorkflow.executeTransition:

if (fromStatus === "PRELIMINARY_INQUIRY") baseDateUpdates.ip_concluded_at = new Date().toISOString();
if (fromStatus === "EVIDENCE_PHASE") baseDateUpdates.last_evidence_act_at = new Date().toISOString();

Those columns feed PHASE_DEADLINES:

  • ip_concluded_at → "notify Nota de Culpa within 30 days of IP conclusion" (and the caducidade guard, see caducidade)
  • last_evidence_act_at → "internal decision deadline, 30 days after instruction closes"

The tacit assumption: the day the operator clicks the button is the legally relevant event date. In reality, an inquiry might have concluded (its last act) days before anyone updates the software. Stamping now() can make a deadline later than the law allows, or record a date that contradicts the paper trail — a real problem when the dossier is scrutinised.

The dates are also toISOString() (UTC) with no timezone handling, while Portuguese legal deadlines run in Europe/Lisbon (see naive deadline math).

What breaks: deadline miscalculation and an audit inconsistency between the recorded "legal" date and reality.

Rebuild implication

Capture legally significant dates as explicit user-entered facts (with their own audit entry), not as a side-effect of a UI action. Store them with an unambiguous timezone.