1
0
forked from ScoDoc/ScoDoc

Meilleur message d'erreur si date abs invalide

This commit is contained in:
Emmanuel Viennet 2022-03-29 10:30:36 +02:00
parent f349c8cad9
commit b5f317083c

View File

@ -229,8 +229,11 @@ def DateRangeISO(date_beg, date_end, workable=1):
date_end = date_beg
r = []
work_saturday = is_work_saturday()
cur = ddmmyyyy(date_beg, work_saturday=work_saturday)
end = ddmmyyyy(date_end, work_saturday=work_saturday)
try:
cur = ddmmyyyy(date_beg, work_saturday=work_saturday)
end = ddmmyyyy(date_end, work_saturday=work_saturday)
except (AttributeError, ValueError) as e:
raise ScoValueError("date invalide !") from e
while cur <= end:
if (not workable) or cur.iswork():
r.append(cur)