asaglimbeni / django-datetime-widget

Bootstrap django-datetime-widget is a simple and clean widget for DateField, Timefiled and DateTimeField in Django framework. It is based on Bootstrap datetime picker, supports both Bootstrap 3 and Bootstrap 2
Other
218 stars 125 forks source link

Option 'format' doesn't seem to work #68

Open melwil opened 9 years ago

melwil commented 9 years ago

As I understand the format option, it decides what the widget will fill into the field?

Currently it fills out 'yyyy-mm-dd hh:mm:ss', and no matter what I fill into format will change this.

Additionally README.md says the default behavior does not include seconds, but it does.

Grokzen commented 9 years ago

I have noticed the same thing. It renders the value but it have no effect once some datetime have been chosen.

asaglimbeni commented 9 years ago

Hi, are you sure that you didn't enable the usel10n? If you add 'format' into options and in the same time set usel10n as True the first one is ignored. Let me know.

Grokzen commented 9 years ago

@asaglimbeni Installation section of the README says Set USE_L10N = True, USE_TZ = True and USE_I18N = True in settings.py and that is what i did :] So you mean if i set it to False it will start to use format ? Also is this in the docs that it behaves this way? If not it could be a improvment to add.

asaglimbeni commented 9 years ago

It is already reported in the documentation at the end of the basc configuration: https://github.com/asaglimbeni/django-datetime-widget#basic-configuration the example configuration is only an example! your implementation could change depending on your needs.

bemall commented 9 years ago

I have format set as 'format': 'MM dd, hh:ii P, yyyy', which results in the date and time being displayed as say "April 05, 09:30 AM 2015". This format works but I get the error "Enter a valid date/time." How can I correct this? @asaglimbeni

Also, how do I disable date and time selection such that a user is not able to select a time that is in the past or unable to select a time that is at least greater than say current time plus two hours ?