From d6dc7953f38e4a35d71851b2ec7141caed04a818 Mon Sep 17 00:00:00 2001
From: Fredrik Jonsson <frjo@xdeb.org>
Date: Mon, 23 Mar 2020 09:52:01 +0100
Subject: [PATCH] Add datetime-local datetime format to DATETIME_INPUT_FORMATS.

---
 hypha/apply/funds/forms.py |  2 +-
 hypha/settings/base.py     | 17 +++++++++++++++++
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/hypha/apply/funds/forms.py b/hypha/apply/funds/forms.py
index cf7f03ac9..45d862403 100644
--- a/hypha/apply/funds/forms.py
+++ b/hypha/apply/funds/forms.py
@@ -415,7 +415,7 @@ class CreateReminderForm(forms.ModelForm):
         queryset=ApplicationSubmission.objects.filter(),
         widget=forms.HiddenInput(),
     )
-    time = forms.DateTimeField(input_formats=['%Y-%m-%dT%H:%M'])
+    time = forms.DateTimeField()
 
     def __init__(self, instance=None, user=None, *args, **kwargs):
         super().__init__(*args, **kwargs)
diff --git a/hypha/settings/base.py b/hypha/settings/base.py
index d3936a389..63e869288 100644
--- a/hypha/settings/base.py
+++ b/hypha/settings/base.py
@@ -323,6 +323,23 @@ SHORT_DATE_FORMAT = 'Y-m-d'
 
 SHORT_DATETIME_FORMAT = 'Y-m-d\TH:i:s'
 
+DATETIME_INPUT_FORMATS = [
+    '%Y-%m-%d %H:%M:%S',     # '2006-10-25 14:30:59'
+    '%Y-%m-%d %H:%M:%S.%f',  # '2006-10-25 14:30:59.000200'
+    '%Y-%m-%d %H:%M',        # '2006-10-25 14:30'
+    '%Y-%m-%dT%H:%M',        # '2006-10-25T14:30 (this is extra)'
+    '%Y-%m-%d',              # '2006-10-25'
+    '%m/%d/%Y %H:%M:%S',     # '10/25/2006 14:30:59'
+    '%m/%d/%Y %H:%M:%S.%f',  # '10/25/2006 14:30:59.000200'
+    '%m/%d/%Y %H:%M',        # '10/25/2006 14:30'
+    '%m/%d/%Y',              # '10/25/2006'
+    '%m/%d/%y %H:%M:%S',     # '10/25/06 14:30:59'
+    '%m/%d/%y %H:%M:%S.%f',  # '10/25/06 14:30:59.000200'
+    '%m/%d/%y %H:%M',        # '10/25/06 14:30'
+    '%m/%d/%y',              # '10/25/06'
+]
+
+
 # Static files (CSS, JavaScript, Images)
 # https://docs.djangoproject.com/en/stable/howto/static-files/
 
-- 
GitLab