Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

startDate and endDate Options #107

Open
lowjumpingfrog opened this issue Nov 29, 2017 · 0 comments
Open

startDate and endDate Options #107

lowjumpingfrog opened this issue Nov 29, 2017 · 0 comments

Comments

@lowjumpingfrog
Copy link

The documentation is not very clear about what format these should be in so, for those looking for the answer....
for start and end dates for current day the option might look like this:

dateTimeOptions = {
			'format': 'dd/mm/yyyy HH:ii',
			'autoclose': True,
			'showMeridian' : True,
			'endDate':  str(datetime.datetime.today().date())
		}

or

dateTimeOptions = {
			'format': 'dd/mm/yyyy HH:ii',
			'autoclose': True,
			'showMeridian' : True,
			'startDate':  str(datetime.datetime.today().date())
		}

You need to import datetime into your forms.py for the examples above to work. The javascript in the datetimewidget is expecting a string. The Javascript Date object is pretty happy with a variety of strings. See docs for ones you might ask Django to create or just add your own.
Ciao

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant