You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Constatamos que o BoletoNet estava gerando incorretamente os boletos com vencimento em 21/02/2025 . Ao analisar, verificamos que estávamos passando um objeto DateTime com hora DateTime(21, 02, 2025, 15 , 0, 0) como data de vencimento.
Como 21/02/2025 15:00 > 21/02/2025 00:00, o método entra no "while" do FatorVencimento já no dia 21/02, quando esse comportamento não deveria aparecer até o dia 22.
Para solucionar, passamos a gerar o objeto Boleto com a data de vencimento truncada (ex: dataVencimento.Date)
public static long FatorVencimento(Boleto boleto)
{
var dateBase = new DateTime(1997, 10, 7, 0, 0, 0);
//Verifica se a data esta dentro do range utilizavel
var dataAtual = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
long rangeUtilizavel = Utils.DateDiff(DateInterval.Day, dataAtual, boleto.DataVencimento);
if (rangeUtilizavel > 5500 || rangeUtilizavel < -3000)
throw new Exception("Data do vencimento fora do range de utilização proposto pela CENEGESC. Comunicado FEBRABAN de n° 082/2012 de 14/06/2012");
while (boleto.DataVencimento > dateBase.AddDays(9999))
dateBase = boleto.DataVencimento.AddDays(-(((Utils.DateDiff(DateInterval.Day, dateBase, boleto.DataVencimento) - 9999) - 1) + 1000));
return Utils.DateDiff(DateInterval.Day, dateBase, boleto.DataVencimento);
}
The text was updated successfully, but these errors were encountered:
Constatamos que o BoletoNet estava gerando incorretamente os boletos com vencimento em 21/02/2025 . Ao analisar, verificamos que estávamos passando um objeto DateTime com hora DateTime(21, 02, 2025, 15 , 0, 0) como data de vencimento.
Como 21/02/2025 15:00 > 21/02/2025 00:00, o método entra no "while" do FatorVencimento já no dia 21/02, quando esse comportamento não deveria aparecer até o dia 22.
Para solucionar, passamos a gerar o objeto Boleto com a data de vencimento truncada (ex: dataVencimento.Date)
The text was updated successfully, but these errors were encountered: