From 7f8fcfeb8abb75594be505348afb317886e39a91 Mon Sep 17 00:00:00 2001 From: Ryan Sullivan Date: Thu, 12 Aug 2021 16:46:26 -0400 Subject: [PATCH] I made a booboo a couple months ago and set format to an array with self.format as the only cell regardless of the value of self.format. This meant that self.format=None would product formats of [None,], or something like that --- tempus_dominus/widgets.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tempus_dominus/widgets.py b/tempus_dominus/widgets.py index 12590e5..4147546 100644 --- a/tempus_dominus/widgets.py +++ b/tempus_dominus/widgets.py @@ -160,11 +160,17 @@ def moment_option(self, value): """ if isinstance(value, str): if isinstance(self, DatePicker): - formats = [self.format] or get_format("DATE_INPUT_FORMATS") + formats = [self.format] if self.format else get_format( + "DATE_INPUT_FORMATS" + ) elif isinstance(self, TimePicker): - formats = [self.format] or get_format("TIME_INPUT_FORMATS") + formats = [self.format] if self.format else get_format( + "TIME_INPUT_FORMATS" + ) else: - formats = get_format("DATETIME_INPUT_FORMATS") + formats = [self.format] if self.format else get_format( + "DATETIME_INPUT_FORMATS" + ) for fmt in formats: try: value = datetime.strptime(value, fmt)