# Inconsistent Time Format After Form Validation Error in Django

**URL:** <https://forum.djangoproject.com/t/inconsistent-time-format-after-form-validation-error-in-django/39479>\
**Category:** Forms & APIs\
**Created:** [March 11, 2025, 1:34pm UTC](https://forum.djangoproject.com/t/inconsistent-time-format-after-form-validation-error-in-django/39479 "2025-03-11T13:34:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![arl\_123](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/arl_123/32/19085_2.png) [@arl\_123](https://forum.djangoproject.com/u/arl_123)\
**Post date:** [March 11, 2025, 1:34pm UTC](https://forum.djangoproject.com/t/inconsistent-time-format-after-form-validation-error-in-django/39479/1 "2025-03-11T13:34:37Z")

</div>

On the initial page load, my `{{ form.start_time.value }}` is displayed as `9 am`. However, if a validation error occurs, it changes to `9:00`, causing an inconsistent format.

I am rendering the time field as follows:

```auto
<input type="time" name="{{ form.prefix }}-start_time" class="..." value="{{ form.start_time.value|time:'H:i' }}">

```

On the initial load, the time is displayed correctly, but after an error, the format becomes inconsistent.

To fix this, I tried specifying the format in the form’s widget:

```auto
start_time = forms.TimeField(widget=forms.TimeInput(format="%H:%M"), localize=False)

```

I also removed the following settings:

```auto
TIME_ZONE = "UTC"
USE_I18N = True
USE_TZ = True

```

However, this didn’t resolve the issue.

I ended up using this workaround:

```auto
for field_name in ["start_time", "end_time", "break_start_time", "break_end_time"]:
    value = self.initial.get(field_name)
    self.initial[field_name] = value.strftime("%H:%M:%S") if value else None

```

This works but causes all my forms to have `has_changed` set to `True`, even when no changes are made.

How can I ensure a consistent time format while avoiding the `has_changed` issue?

Thank you in advance! Let me know if you need more details. I am using an initial formset with model form.
