Nathan Kahl
Posts: 0
Joined: Tue Nov 20, 2012 4:03 am

How do you set the default date within the date picker to today's date?

The article that explains how to do this is no longer available...

Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

How do you set the default date within the date picker to today's date?

Add javascript code on screen load:

precode
var currDate = new Date();
$('div[dsid="mobiledatepicker1"] input').val((currDate.getMonth()+1)+'/'+currDate.getDate()+'/'+currDate.getFullYear());
/code/pre
Make sure the component is called 'mobiledatepicker1' or use whatever name you set.

Mike6979865
Posts: 0
Joined: Fri Jul 11, 2014 3:53 pm

How do you set the default date within the date picker to today's date?

I used this code, and it shows the date. However, when I click on search nothing appears. I would have to then manually click on calender, and select the same date. So, I have on click set local storage variable which is the date. However, even though the correct date is in the box, it's not recognizing it when it's showing today's date.

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

How do you set the default date within the date picker to today's date?

Hello Mike,

Please show us screen shot.
Please note, by default datepicker component displays current today date http://devcenter.appery.io/documentat...

Mike6979865
Posts: 0
Joined: Fri Jul 11, 2014 3:53 pm

How do you set the default date within the date picker to today's date?

The thing is it's asking me to set a default day. I can't delete that. I want today's date to show when I run the program.

Image

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

How do you set the default date within the date picker to today's date?

Hi Mike,

Following code works for me:

pre

//Create date. You can set here the date you need.
var currDate = new Date();

//Note: you should replace "mobiledatepicker_132" with your datepicker component.
$('div[dsid="mobiledatepicker_132"] input').val((currDate.getMonth()+1)+'/'+currDate.getDate()+'/'+currDate.getFullYear());

console.log("Set date for datepicker component as = '" + (currDate.getMonth()+1)+'/'+currDate.getDate()+'/'+currDate.getFullYear() + "'");

/pre

So you can run this code on "page show" event and do not care about default date in component properties.

Regards.

Mike6979865
Posts: 0
Joined: Fri Jul 11, 2014 3:53 pm

How do you set the default date within the date picker to today's date?

Worked like magic ! :) Thank you Yurii.

Mike6979865
Posts: 0
Joined: Fri Jul 11, 2014 3:53 pm

How do you set the default date within the date picker to today's date?

Well, yes, it did show today's date, but I still have the same problem. When I click on Search, it's now reading the value that is showing in the textbox of the date picker. Here's a screen shot

Image

Mike6979865
Posts: 0
Joined: Fri Jul 11, 2014 3:53 pm

How do you set the default date within the date picker to today's date?

Well, yes, it did show today's date, but I still have the same problem. When I click on Search, it's now reading the value that is showing in the textbox of the date picker. Here's a screen shot

Image

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

How do you set the default date within the date picker to today's date?

Hi Mike,

Can not understand your problem.

Please give us more details.

Regards.

Return to “Issues”