header.dates
Header dates: StartDate, EndDate, FiscalYear, DateCreated
Time-window invariants AT enforces on the SAF-T Header block.
What AT checks
The Header block of the SAF-T file describes the period the file covers and when it was generated. AT enforces a few invariants on these dates:
| Field | Constraint |
|---|---|
StartDate | The first date covered by the file. |
EndDate | Must not be before StartDate (a one-day period is valid). |
FiscalYear | The year of StartDate, or the year before it when the fiscal year doesn't follow the calendar year (e.g. February to January). |
DateCreated | Should be on or after EndDate: you can't generate a file before the period it covers ends. |
A correct example
The monthly invoicing file for September 2026, generated on 3 October by a company whose fiscal year is the calendar year:
<Header>
...
<FiscalYear>2026</FiscalYear>
<StartDate>2026-09-01</StartDate>
<EndDate>2026-09-30</EndDate>
...
<DateCreated>2026-10-03</DateCreated>
...
</Header>
All dates use the YYYY-MM-DD format. For a company whose fiscal year runs from April to March, the file for January 2027 would still say FiscalYear 2026, and SAFTCheck reports that as information rather than an error.
The header dates also set the period every document in the file must fall in: see documents outside the header period.
Sub-rules SAFTCheck applies
header.dates.range: fires whenStartDateis afterEndDate.header.dates.fiscal_year_previous:FiscalYearis the year beforeStartDate's: correct for a non-calendar fiscal year, a mistake otherwise (info).header.dates.fiscal_year_mismatch:FiscalYearis any other year (warning).header.dates.created_before_end: fires whenDateCreated < EndDate(warning; AT may still accept).header.dates.future_end: fires whenEndDateis in the future (warning).
Common mistakes
- Year-end rollover. A January file with
FiscalYear=2025butStartDate=2026-01-01from a company whose fiscal year is the calendar year. The ERP rolled the year on one field but not the other. - Wrong period unit. Submitting a quarter when AT expects a month, or the other way round. The dates declare the unit; mismatching it against the submission window is a separate AT-side check.
- DateCreated set during testing. Files exported during ERP setup sometimes carry a
DateCreatedin the past or future from when they were actually built.
How to fix
- Check the export period selection in the ERP: most issues come from selecting the wrong start/end month.
- If the dates are right and only the FiscalYear is off, edit the company's fiscal year setting in the ERP and re-export. For one-off submissions, the inline editor can patch
FiscalYeardirectly on the validation result page. - If
DateCreatedis in the future or beforeEndDate, fix the ERP system clock and re-export, or use the inline editor for the immediate file.
The combined header.dates.range finding (StartDate vs EndDate) is not editable as a single field: fix StartDate or EndDate individually with the inline editor, or re-export.
Related
- Inline editor: patch FiscalYear / EndDate / DateCreated in place.
- Documents outside the header period
- SAF-T (PT) submission deadline
- SAF-T Portugal: what it is, who files, deadlines and rejections