django-bootstrap3-datetimepicker
django-bootstrap3-datetimepicker copied to clipboard
startDate issue
trafficstars
This is quite strange.
now = timezone.localtime(timezone.now())
# US date format because DatePicker wants like this
now = now.strftime('%m/%d/%y')
Now I define a field in a Form:
start = forms.DateTimeField(required=True,widget=DateTimePicker(options={
'pickTime': False,
'startDate': now
}))
and everything goes well. But then I subclass the Form and in the subclass __init__ I want to modify the field with time picking as well (now is defined exactly as above):
self.fields['start'].widget = DateTimePicker(options={
'pickTime': True,
'startDate': now,
})
Now the issue: starting date is tomorrow, the day after. I have to force it with:
now = now - relativedelta(days = 1)
Maybe it's not a startDate issue but something related to Django?