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)