Page 2 of 2

Datepicker within collapsible

Posted: Thu Jul 24, 2014 3:49 am
by Yurii Orishchuk

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.


Datepicker within collapsible

Posted: Fri Jul 25, 2014 12:18 am
by Aeneas McBurney

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());


Datepicker within collapsible

Posted: Fri Jul 25, 2014 2:33 am
by Yurii Orishchuk

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.


Datepicker within collapsible

Posted: Wed Jul 30, 2014 1:51 am
by Aeneas McBurney

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


Datepicker within collapsible

Posted: Wed Jul 30, 2014 2:00 am
by Alena Prykhodko

Hello,

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