Skip to content

Commit

Permalink
wip agu 2024, small bugfix on date selector if 1970 -> 2023
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasLecocq committed Dec 6, 2023
1 parent 81325cc commit 2982dd9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion msnoise/msnoise_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,10 @@ def edit_form(self, obj=None):
if obj.name in default_datetime_fields:
nf = DateField("value", widget=widgets.DatePickerWidget())
nf = nf.bind(form, "value")
nf.data = datetime.datetime.strptime(obj.value, "%Y-%m-%d")
if obj.value == "1970-01-01":
nf.data = datetime.datetime.strptime("2023-01-01", "%Y-%m-%d")
else:
nf.data = datetime.datetime.strptime(obj.value, "%Y-%m-%d")
form._fields["value"] = nf

elif len(d.possible_values):
Expand Down

0 comments on commit 2982dd9

Please sign in to comment.