Skip to content

Commit 5385320

Browse files
author
Mathieu Dupuy
committed
Appointment: remove useless date validity check
1 parent 022442c commit 5385320

File tree

1 file changed

+0
-10
lines changed

1 file changed

+0
-10
lines changed

appointment/models.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -314,12 +314,6 @@ def clean(self):
314314
raise ValidationError(_("Start time must be before end time"))
315315
if self.start_time == self.end_time:
316316
raise ValidationError(_("Start time and end time cannot be the same"))
317-
# Check for valid date
318-
try:
319-
# This will raise a ValueError if the date is not valid
320-
datetime.datetime.strptime(str(self.date), '%Y-%m-%d')
321-
except ValueError:
322-
raise ValidationError(_("The date is not valid"))
323317

324318
# Ensure the date is not in the past:
325319
if self.date < datetime.date.today():
@@ -338,10 +332,6 @@ def save(self, *args, **kwargs):
338332
# duration should not exceed the service duration
339333
if time_difference(self.start_time, self.end_time) > self.service.duration:
340334
raise ValidationError(_("Duration cannot exceed the service duration"))
341-
try:
342-
datetime.datetime.strptime(str(self.date), '%Y-%m-%d')
343-
except ValueError:
344-
raise ValidationError(_("The date is not valid"))
345335
return super().save(*args, **kwargs)
346336

347337
def get_service_name(self):

0 commit comments

Comments
 (0)