Source code for cadrumo.domain.contribuyente.marriage_facts
"""Marriage-period predicates consumed by Modelo profile bindings."""from__future__importannotationsfromdatetimeimportdate
[docs]defmarriage_full_year(marriage_date:date,filing_year:int)->bool:"""True when the marriage predates the filing year (vigente todo el año)."""returnmarriage_date.year<filing_year
[docs]defmarriage_month_start(marriage_date:date,filing_year:int)->int|None:"""Return the first month married in *filing_year*, or None when full-year. When the marriage occurred *before* the filing year the form's casilla 0246 is left at 1 (the standard primer-mes for a full-year marriage). When the marriage occurred *during* the filing year the actual month is returned. When the marriage occurred *after* the filing year (future date) None is returned and no fact is written. """ifmarriage_date.year<filing_year:return1ifmarriage_date.year==filing_year:returnmarriage_date.monthreturnNone