diff --git a/app/scodoc/notesdb.py b/app/scodoc/notesdb.py index e0f24606..5aa5c91b 100644 --- a/app/scodoc/notesdb.py +++ b/app/scodoc/notesdb.py @@ -460,7 +460,8 @@ def dictfilter(d, fields, filter_nulls=True): # --- Misc Tools -def DateDMYtoISO(dmy: str, null_is_empty=False) -> str | None: # XXX deprecated +# XXX deprecated, voir convert_fr_date +def DateDMYtoISO(dmy: str, null_is_empty=False) -> str | None: """Convert date string from french format (or ISO) to ISO. If null_is_empty (default false), returns "" if no input. """ @@ -479,7 +480,7 @@ def DateDMYtoISO(dmy: str, null_is_empty=False) -> str | None: # XXX deprecated try: dt = datetime.datetime.fromisoformat(dmy) except ValueError as exc: - raise ScoValueError(f'Date (j/m/a or iso) invalide: "{dmy}"') from exc + raise ValueError(f'Date (j/m/a or iso) invalide: "{dmy}"') from exc return dt.date().isoformat() diff --git a/app/scodoc/sco_evaluation_edit.py b/app/scodoc/sco_evaluation_edit.py index 3824ca60..2b47e131 100644 --- a/app/scodoc/sco_evaluation_edit.py +++ b/app/scodoc/sco_evaluation_edit.py @@ -374,13 +374,7 @@ def evaluation_create_form( args = tf[2] # modifie le codage des dates # (nb: ce formulaire ne permet de créer que des évaluation sur la même journée) - if args.get("jour"): - try: - date_debut = datetime.datetime.strptime(args["jour"], "%d/%m/%Y") - except ValueError as exc: - raise ScoValueError("Date (j/m/a) invalide") from exc - else: - date_debut = None + date_debut = scu.convert_fr_date(args["jour"]) if args.get("jour") else None args["date_debut"] = date_debut args["date_fin"] = date_debut # même jour args.pop("jour", None) diff --git a/app/scodoc/sco_formsemestre_edit.py b/app/scodoc/sco_formsemestre_edit.py index c8de7b9f..6ee35513 100644 --- a/app/scodoc/sco_formsemestre_edit.py +++ b/app/scodoc/sco_formsemestre_edit.py @@ -812,14 +812,18 @@ def do_formsemestre_createwithmodules(edit=False, formsemestre: FormSemestre = N ) msg = "" if tf[0] == 1: - # check dates - if ndb.DateDMYtoISO(tf[2]["date_debut"]) > ndb.DateDMYtoISO(tf[2]["date_fin"]): - msg = '