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

using Now as startDate #102

Open
balinabbb opened this issue Jul 10, 2017 · 1 comment
Open

using Now as startDate #102

balinabbb opened this issue Jul 10, 2017 · 1 comment

Comments

@balinabbb
Copy link

Hi,

I would like to use create a picker which won't accept past dates.
This would be the correct syntax to make it possible. However beacuse of this and this line I can't use that sytax. If I use datetime.now() in django, that now will be the now of the backend application launch, and not the client side page load.

I commented this line, which solved my problem, but do you have some better idea? I have some solutions in mind if you are interested.

@treyd
Copy link

treyd commented Nov 16, 2017

I'm having this same problem. I have the following options in my form:

    datetime_widget_opts = {
        'startDate': str(timezone.now())
    }
...
datefield = forms.DateTimeField(label="Start Date",
                                             widget=DateTimeWidget(
                                                 usel10n=True,
                                                 bootstrap_version=3,
                                                 options=datetime_widget_opts
                                             )
)
...

But, the widget still lets me pick dates in the past. Looking through the JS it seems startDate is the right parameter but I wonder if timezone.now() isn't in the right format, but the docs don't say how it should be. What format should startDate and endDate be in the config?

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

2 participants