monim67 / django-bootstrap-datepicker-plus

Bootstrap3/Bootstrap4/Bootstrap5 DatePickerInput, TimePickerInput, DateTimePickerInput, MonthPickerInput, YearPickerInput with date-range-picker functionality for django >= 2.0
https://pypi.python.org/pypi/django-bootstrap-datepicker-plus
MIT License
223 stars 61 forks source link

TimePickerInput does not honor time format #94

Closed eburkland closed 1 year ago

eburkland commented 1 year ago

Describe the problem Bumping versions of django-bootstrap-datepicker-plus from 3.0.5 to 5.0.3 I am having issues with TimePickerInput widget. In the older version we would see the time as 01-12 hour and AM/PM designation. Now I see a 24 clock despite all attempts to modify the code. It does not seem to be honoring the format='%I:%M %p'

Code Snippet which worked in version 3.0.5:

time = forms.TimeField( widget=TimePickerInput(format='%I:%M %p',attrs={'autocomplete' : 'off'},options={ 'useCurrent' : False, }), input_formats=['%I:%M %p'], )

Setup Information:

Any ideas?

eburkland commented 1 year ago

Figured it out

time = forms.TimeField(
    widget=TimePickerInput(attrs={'autocomplete' : 'off'},options={
        'showClear' : True,
        'showTodayButton' : True,
        'showClose' : True,
        'format' : 'hh:mm a',
        'useCurrent' : False,
    }),
    input_formats=['%I:%M %p'],
)