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

Datepicker within collapsible

Hi Aeneas,

Please use following code:

pre

//This is a date object to set value. Change it with date you need.
var date = new Date();

//Note: you need to replace "mobiledatepicker_2" with your datepicker component value.
var dateValue = $.datepicker.formatDate(Appery("mobiledatepicker_2").getAttr("dateFormat"), date);

//Note: you need to replace "mobiledatepicker_2" with your datepicker component value.
Appery("mobiledatepicker_2").setAttr("defaultDateValue", dateValue);

/pre

Regards.

Aeneas McBurney
Posts: 0
Joined: Mon Jun 16, 2014 7:49 am

Datepicker within collapsible

The first 2 alerts show date as 17-Jul-2014 but the toISOString alert shows a date of 16-Jul-2014 not 17-Jul-2014 which is what I require for query. Why is this happening?

var datefrom=''07/17/2014";
var datefromObject = new Date(datefrom);
alert(datefrom);
alert(datefromObject);
alert(datefromObject.toISOString());

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

Datepicker within collapsible

Hi Aeneas,

You are faced with time-zone issue.

Please use following code to fix it:

pre

var datefrom = "07/17/2014";
var datefromObject = new Date(datefrom);
alert(datefrom);
alert(datefromObject);

//alert(datefromObject.toISOString());

var utcDate = new Date(datefromObject.getTime() - (datefromObject.getTimezoneOffset() * 60000));

alert(utcDate.toISOString());

/pre

Regards.

Aeneas McBurney
Posts: 0
Joined: Mon Jun 16, 2014 7:49 am

Datepicker within collapsible

I am now trying this same method with Dateto

The datepicker says is '2014-07-30'

But the following code returns a date of '2014-07-29'??

var dateto = $("[name=dateTo] input").val();
var datetoObject = new Date(dateto);
var utcDateTo = new Date(datetoObject.getTime()- (datefromObject.getTimezoneOffset() * 60000));
utcDateTo.toISOString()

Thanks,
Aeneas

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

Datepicker within collapsible

Hello,

Custom code is out of scope of our support, please search online how to fetch date to format you need.

Return to “Issues”