Nick7568710
Posts: 0
Joined: Wed Jun 03, 2015 2:36 pm

How do you get the Current Date as the default for the Date Picker? And how do you get the current date as a string?

I am making an app that tracks when employees are scheduled to work. On the main page, I would like to display the person who is scheduled to work on the current date. I also have it so people can request days off with a date picker. I would like to set the date picker to the current date when they use the app.

Additionally, the date picker returns values as strings (so i've been working with the dates in my databases as strings), but everything I've found so far about getting the current date in java script or jquery returns the current date in date format. This would make me unable to compare the current date to the data I have in my databases, since they are in string format.

How can I get the current date as a string?

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

How do you get the Current Date as the default for the Date Picker? And how do you get the current date as a string?

Hello Nick,

You can get datepicker value with JS below:

var datepicker = $("[name=mobiledatepickerName] input").val();

and parse it via Date object:

var date = new Date(datepicker);

How do you get the Current Date as the default for the Date Picker?
Please follow this topic: https://getsatisfaction.com/apperyio/...

Nick7568710
Posts: 0
Joined: Wed Jun 03, 2015 2:36 pm

How do you get the Current Date as the default for the Date Picker? And how do you get the current date as a string?

Thanks for the response!

I followed the topic and got the current date to work.

Instead of running the javascript you mentioned, I just mapped the value of the datepicker to a storage variable since that was the current date in string format I needed. Thank you!

Return to “Issues”