Page 1 of 1

How do i set "Default Date", "Min Date" and "Max date" values for a date picker using java script?

Posted: Thu Oct 23, 2014 6:42 pm
by girish

How do i set "Default Date", "Min Date" and "Max date" values for a date picker using java script?


How do i set "Default Date", "Min Date" and "Max date" values for a date picker using java script?

Posted: Fri Oct 24, 2014 3:08 am
by Yurii Orishchuk

Hi Girish,

Please use following code go define custom parameters for your datepicker component:

pre

var options = {
dateFormat: "mm/dd/yy",
firstDay: 0,

Code: Select all

 maxDate: new Date("10/30/2014"), 

 minDate: new Date("10/08/2014"), 

 dayNamesMin: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'], 
 monthNames: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], 
 showOtherMonths: true, 

 defaultDate: new Date("11/08/2014") 

};
new Apperyio.ApperyMobileDatePickerComponent("test_mobiledatepicker_239", options)

/pre

Regards.


How do i set "Default Date", "Min Date" and "Max date" values for a date picker using java script?

Posted: Fri Oct 24, 2014 6:56 am
by girish

Thanks. Guess this is for creating a date picker component dynamially via JavaScript. But I just need to 1) read and 2) modify the parameters of an existing date picker component in my page. Can you pls suggest for point 1 and 2?


How do i set "Default Date", "Min Date" and "Max date" values for a date picker using java script?

Posted: Fri Oct 24, 2014 10:10 am
by Evgene Karachevtsev

Hello Girish,

You can change default, min and max dates this way:
Apperyio("mobiledatepicker_13").datepicker_dataPickerOptions.defaultDate = new Date()
Apperyio("mobiledatepicker_13").datepicker_dataPickerOptions.minDate = new Date()
Apperyio("mobiledatepicker_13").datepicker_dataPickerOptions.maxDate = new Date()
Apperyio("mobiledatepicker_13").initializeDataPicker()


How do i set "Default Date", "Min Date" and "Max date" values for a date picker using java script?

Posted: Sun Oct 26, 2014 1:08 pm
by girish

Thanks, that worked. Now i need to get the date value set. When i tried this, it doesnt work

Apperyio("mobiledatepicker_13").val()


How do i set "Default Date", "Min Date" and "Max date" values for a date picker using java script?

Posted: Mon Oct 27, 2014 2:02 am
by Yurii Orishchuk

Hi Girish,

Here is code to get value:

pre

var date = Apperyio("mobiledatepicker_239").datepicker_dataPickerOptions.defaultDate;

/pre

Regards.


How do i set "Default Date", "Min Date" and "Max date" values for a date picker using java script?

Posted: Wed Nov 04, 2015 12:47 pm
by Liviu

what if i want the new date to be the current date, can i read it somehow from the phone? if yes, how can i do that?


How do i set "Default Date", "Min Date" and "Max date" values for a date picker using java script?

Posted: Wed Nov 04, 2015 6:30 pm
by Serhii Kulibaba

Hello,

Please read it with JS:

var value = (new Date()).toISOString();