From 7cb81096337dd6d42c49994045c385d903855992 Mon Sep 17 00:00:00 2001 From: Danilo Date: Tue, 18 Feb 2025 11:57:26 -0300 Subject: [PATCH] =?UTF-8?q?Corrigindo=20bug=20do=20vencimento=20do=20bolet?= =?UTF-8?q?o=20para=20datas=20ap=C3=B3s=2022/02/2025?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pyboleto/data.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pyboleto/data.py b/pyboleto/data.py index 28cede0..97a1731 100644 --- a/pyboleto/data.py +++ b/pyboleto/data.py @@ -211,7 +211,13 @@ def barcode(self): value, len(value))) - due_date_days = (self.data_vencimento - _EPOCH).days + # reiniciar a contagem em 1000 se a data de vencimento for maior que 22/02/2025 + if self.data_vencimento >= datetime.date(2025,2,22): + due_date_days = (self.data_vencimento - _EPOCH).days + due_date_days -= 9000 + else: + due_date_days = (self.data_vencimento - _EPOCH).days + if not (9999 >= due_date_days >= 0): raise TypeError( "Invalid date, must be between 1997/07/01 and "