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

Datepicker within collapsible

I am trying to set the value of a datepicker inside a collapsible on page load but its not working. This is the code I have which I know works when date is outside collapsible.

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

Also how do I get the current date value of a datepicker with js?

Also how do you use date in a gte where clause? This doesn't work

{_createdAt:{$gte:'2014-07-10'}}

Thanks,
Aeneas

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Datepicker within collapsible

Hi Aeneas,

Here is how to get a date from datepicker named mobiledatepickerName:prevar val = $("[name=mobiledatepickerName] input").val();/pre
Please convert it to ISO format before using it in request, then your code will look as follows:prereturn '{"_createdAt":{"$gte":"' + val.toISOString() + '"}}';/pre

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

Datepicker within collapsible

Hi Katya, thanks for your response.

When I run this script it fails on the last line. So the first alert returns the correct date and the 2nd alert crashes the script.

var dateto = $("[name=dateTo] input").val();
alert(dateto);
alert(dateto.toISOString());

Also if you could answer the first part of my question above on how to set default date within a collapsible.

Thanks,
Aeneas

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

Datepicker within collapsible

Hi Aeneas,

Please use following code instead of yours:

pre

var dateto = $("[name=dateTo] input").val();
alert(dateto);
var dateObject = new Date(dateto);
alert(dateObject.toISOString());

/pre

Regards.

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

Datepicker within collapsible

Hi Yurri,

That works thanks!

How about my other question in regards to setting default date in collapsible.........

I am trying to set the value of a datepicker inside a collapsible on page load but its not working. This is the code I have which I know works when date is outside collapsible.

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

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

Datepicker within collapsible

I have managed to get the date in correct format however when I pass to the query its returning no data. Please see 2 screenshots attached with first being with no ate filter clearly showing a date that should be included in the next screen shot where I have the date filter.

Data....
Image

No data....
Image

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Datepicker within collapsible

Hello Aeneas,

Could you please try this code:
pre{"_createdAt": {"$gte":{"$date":"2012-11-14T21:54:56.757Z"}}}/pre

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

Datepicker within collapsible

That works great thanks!

Now how do I set the default date of a datepicker within a collapsible?

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

Datepicker within collapsible

You can set default value in Properties (set the Default Date property). You can also set the default value via JavaScript -- for example on page load.

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

Datepicker within collapsible

Hi Alena and thanks for your response.

I am trying to set it via javascript as per my original post which was.....

I am trying to set the value of a datepicker inside a collapsible on page load but its not working. This is the code I have which I know works when date is outside collapsible.

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

Return to “Issues”