girish
Posts: 0
Joined: Sat Aug 30, 2014 12:15 pm

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?

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

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

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.

girish
Posts: 0
Joined: Sat Aug 30, 2014 12:15 pm

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

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?

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

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

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()

girish
Posts: 0
Joined: Sat Aug 30, 2014 12:15 pm

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

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

Apperyio("mobiledatepicker_13").val()

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

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

Hi Girish,

Here is code to get value:

pre

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

/pre

Regards.

Liviu
Posts: 0
Joined: Fri Oct 16, 2015 12:42 am

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

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?

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

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

Hello,

Please read it with JS:

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

Return to “Issues”