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?

So, the problem is even though I see today's date in the input on page show based on the code that you provided, when I click on View Ticket By Date, it's not searching for tickets for that date. In order for it to work, I have to click on the calender button, select a day, and then click view tickets by date. So, I'm trying to avoid that.

Regards,

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,

Thanks for detail explanation.

Yes you are right code above only change view. And does not change value to store in service.

Here is correct code for you:

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()).trigger("change");
console.log("Set date for datepicker component as = '" + (currDate.getMonth()+1)+'/'+currDate.getDate()+'/'+currDate.getFullYear() + "'");

/pre

Regards.

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

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

hi sir yuri,

how to remove the seperator into the date? for example if the date picker is format like this 10-22-2014, i want to change the format like this 10222014 into the label everytime i change the date.

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 She,

Please follow these steps:

1 Activate datePicker.

2 Add "value change" event with action "Run JavaScript".

3 Populate it with following code:

pre

//Replace "startDate" with your datePicker component name.
var dateText = Apperyio("startDate").attr("defaultDate");

dateText = dateText.replace(/\/|-/gi, "");

//Replace "dateLabel" with your label component name.
Apperyio("dateLabel").text("dateText = " + dateText);

/pre

Details: http://prntscr.com/4ytb18/direct

Regards.

danielle lee
Posts: 0
Joined: Wed Nov 12, 2014 3:06 pm

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

I cannot get the date picker to change the default to the current date. I have tried everything Please help!

Return to “Issues”