Kacey Cleveland
Posts: 0
Joined: Thu Apr 16, 2015 6:25 am

How do I set the minimum date to today?

I'm using the input drag-and-drop jquery box with type date. I was wondering how to set the minimum date to whatever the current date is so no one can pick a date thats in the past?

I've tried treating it as a jquery date input but the datepicker method doesn't work with it for some reason (it says its not a function).

Any help is much appreciated, thanks!

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

How do I set the minimum date to today?

Hello Kacey,

Please follow this topic: http://stackoverflow.com/questions/14...

Kacey Cleveland
Posts: 0
Joined: Thu Apr 16, 2015 6:25 am

How do I set the minimum date to today?

How do I access the datepicker method? It doesn't seem to work for me, it always says in the console that datepicker isn't a method.

Thanks again for the help!

She
Posts: 0
Joined: Wed Oct 08, 2014 12:46 am

How do I set the minimum date to today?

Hi Kacey,
try this in pageshow event:
code
//change calendar1 to the name of your datepicker
var dateElement = Appery("calendar1");
dateElement.setProperty("defaultDateValue", $.datepicker.formatDate(dateElement.datepicker_dataPickerOptions.dateFormat, new Date()));
/code

Goodluck,
She

Kacey Cleveland
Posts: 0
Joined: Thu Apr 16, 2015 6:25 am

How do I set the minimum date to today?

I tried the following code:

var dateElement = Appery("event_date_input");
dateElement.setProperty("defaultDateValue", $.datepicker.formatDate(dateElement.datepicker_dataPickerOptions.dateFormat, new Date()));

where event_date_input is my datepicker input from the drag and drop menu.

and got this in the console:
Uncaught TypeError: Cannot read property 'formatDate' of undefined

Hope this helps.

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

How do I set the minimum date to today?

Hi Kacey,

I tried the same code and it works for me.

Please specify more info about your context(where you use this code etc..)

Thanks.

Kacey Cleveland
Posts: 0
Joined: Thu Apr 16, 2015 6:25 am

How do I set the minimum date to today?

I use the input drag-and-drop component with the Type set as date. I have this input put into a pop-up that appears when a button is pressed on the page, I use this code on the page-show of the home-screen page that contains the popup.

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

How do I set the minimum date to today?

Hi Kacey,

It's strange behavior. Like there is not $.datepicker object.

Please give us your app public link and describe steps to reproduce this problem in your app.

Regards.

Return to “Issues”