Page 2 of 4

Datepicker default date Today

Posted: Sun Jul 28, 2013 7:55 am
by Igor

Please try add ")" at the end of code, you have missed it.


Datepicker default date Today

Posted: Sun Jul 28, 2013 7:59 am
by Andy Suciu

wow. great. thanks a lot!


Datepicker default date Today

Posted: Wed Jan 08, 2014 5:52 pm
by Daniel6560000

Good Day

Using this method, how can i set the default date to the first day of the year,
I thought of changing the
new Date()

by something like something like this:

var dateElement = Appery("todate");
var currDate = new Date();
...
dateElement.setProperty("defaultDateValue", $.datepicker.formatDate(dateElement.datepicker_dataPickerOptions.dateFormat, '01/01/'+currDate.getFullYear()));

What am I doing wrong please
Thanks

Daniel


Datepicker default date Today

Posted: Wed Jan 08, 2014 7:30 pm
by Maryna Brodina

Hello! In $.datepicker.formatDate with a second parameter you have to pass not string, but object Date. If you have for datepicker the following Date Format mm/dd/yy
or
dd/mm/yy
Try this code prevar dateElement = Appery("todate");
var currDate = new Date();
dateElement.setProperty("defaultDateValue", '01/01/'+currDate.getFullYear());/pre


Datepicker default date Today

Posted: Thu Feb 13, 2014 4:59 am
by John6122514

Hello.
I am using Maryna suggestion and it works great. Can you tell me how I would add days (+ 5) to the current date using this?

var dateElement = Appery("date");
dateElement.setProperty("defaultDateValue", $.datepicker.formatDate(dateElement.datepicker_dataPickerOptions.dateFormat, new Date()));


Datepicker default date Today

Posted: Thu Feb 13, 2014 9:48 pm
by Kateryna Grynko

Hi John,

Use this code please: prevar d = new Date(Appery("mobiletextinput").val());
d.setDate(d.getDate() + 5);
Appery("mobiletextinput").val(d.getYear + "-" + d.getMonth() + "-" + d.getDate());/preWhere 'mobiletextinput' is a name of date input component.


Datepicker default date Today

Posted: Fri Feb 14, 2014 7:59 pm
by John6122514

Sorry. That did not work. Just freezes


Datepicker default date Today

Posted: Fri Feb 14, 2014 9:40 pm
by Kateryna Grynko

Hi John,

Try this code please: prevar d = new Date(Appery("mobiletextinput").val());
d.setDate(d.getDate() + 5);

var dd = d.getDate();
var mm = d.getMonth()+1; //January is 0!

var yyyy = d.getFullYear();
if (dd < 10) {dd='0'+dd}
if (mm < 10) {mm='0'+mm}
mydate = yyyy+'-'+mm+'-'+dd;
Appery("mobiletextinput")&#46;val(mydate);
/preWhere 'mobiletextinput' is a name of date input component.

This code will increase current date component value by 5 days.


Datepicker default date Today

Posted: Thu Feb 20, 2014 11:14 pm
by John6122514

The script runs but it does not set the date.


Datepicker default date Today

Posted: Thu Feb 20, 2014 11:24 pm
by Illya Stepanov

Hi John - are there any errors in the console?

You can also try to debug the code - to see what values are passing.
:: http://docs.appery.io/documentation/d...