From 21ccc83d69a3a4d87ccfaddae242e4670c52f1be Mon Sep 17 00:00:00 2001 From: finnertysea <26181241+finnertysea@users.noreply.github.com> Date: Fri, 17 Mar 2023 13:12:03 -0700 Subject: [PATCH] #1075 - make view agnostic to format of incoming due date --- helpdesk/views/staff.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/helpdesk/views/staff.py b/helpdesk/views/staff.py index 7d33f6a9..d54bfd94 100644 --- a/helpdesk/views/staff.py +++ b/helpdesk/views/staff.py @@ -10,7 +10,7 @@ from ..lib import format_time_spent from ..templated_email import send_templated_mail from collections import defaultdict from copy import deepcopy -from datetime import date, datetime, timedelta +from datetime import date, datetime, time, timedelta from django.conf import settings from django.contrib.auth import get_user_model from django.contrib.auth.decorators import user_passes_test @@ -24,7 +24,7 @@ from django.http import Http404, HttpResponse, HttpResponseRedirect, JsonRespons from django.shortcuts import get_object_or_404, redirect, render from django.urls import reverse, reverse_lazy from django.utils import timezone -from django.utils.dateparse import parse_datetime +from django.utils.dateparse import parse_date, parse_datetime from django.utils.html import escape from django.utils.timezone import make_aware from django.utils.translation import gettext as _ @@ -521,7 +521,8 @@ def get_due_date_from_request_or_ticket( due_date = request.POST.get('due_date', None) or None if due_date is not None: - due_date = make_aware(parse_datetime(due_date)) + parsed_date = parse_datetime(due_date) or datetime.combine(parse_date(due_date), time()) + due_date = make_aware(parsed_date) else: due_date_year = int(request.POST.get('due_date_year', 0)) due_date_month = int(request.POST.get('due_date_month', 0))