Page 1 of 1

How do I set the minimum date to today?

Posted: Tue Apr 28, 2015 10:31 pm
by Kacey Cleveland

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!


How do I set the minimum date to today?

Posted: Wed Apr 29, 2015 6:16 am
by Serhii Kulibaba

Hello Kacey,

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


How do I set the minimum date to today?

Posted: Fri May 08, 2015 6:15 am
by Kacey Cleveland

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!


How do I set the minimum date to today?

Posted: Fri May 08, 2015 7:12 am
by She

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


How do I set the minimum date to today?

Posted: Fri May 08, 2015 9:47 am
by Kacey Cleveland

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.


How do I set the minimum date to today?

Posted: Mon May 11, 2015 3:02 am
by Yurii Orishchuk

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.


How do I set the minimum date to today?

Posted: Mon May 11, 2015 5:01 pm
by Kacey Cleveland

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.


How do I set the minimum date to today?

Posted: Tue May 12, 2015 3:25 am
by Yurii Orishchuk

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.