egonzalez
Posts: 0
Joined: Fri Sep 14, 2012 9:34 pm

Date Picker issue with Parse DB

I'm using the date picker to pass a date into Parse DB and regardless of the date I choose, it always passes in today's date. Any suggestions?

One more date related question. I am able to format the date into a JSONstring when sending it to Parse, but I am not sure how to format the date into dd/mm/yyyy when it is returned to the app.
Thanks
Eric

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Date Picker issue with Parse DB

Do you just map the calendar to the service? I guess it just sends the current value (set from properties). Try reading the value with JavaScript and passing it to the service that way.

How do you try to format the date that's returned from Parse?

egonzalez
Posts: 0
Joined: Fri Sep 14, 2012 9:34 pm

Date Picker issue with Parse DB

I just map the calendar to the service. I did the same mapping with tiggzi DB and it worked. For Parse DB I also added the following code to create the JSONstring:

var d = new Date();
var isoDate = d.toISOString();
var dateJSON = {"__type": "Date", "iso": isoDate};
return dateJSON;

The date goes into Parse but always shows today's date.

I've tried different code snippets to try and convert the JSONstring to date format dd/mm/yyyy when I get data from Parse with no success. Do you have any snippets that may work? =)

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Date Picker issue with Parse DB

Parse creates a record with today's date?

egonzalez
Posts: 0
Joined: Fri Sep 14, 2012 9:34 pm

Date Picker issue with Parse DB

When I pull a record from Parse it comes though in this format
2012-05-15T19:29:43.851Z

I'd like to format it like this 5/15/2012

I'm trying to figure out what Javascript to use to format it correctly.
Thanks
Eric

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Date Picker issue with Parse DB

You could just get this part "2012-05-15" from the string and then format it.

egonzalez
Posts: 0
Joined: Fri Sep 14, 2012 9:34 pm

Date Picker issue with Parse DB

Would I need to add custom javascript to get this format? I can't figure out how to do it. I've tried

return Date(mm,dd,yy);

egonzalez
Posts: 0
Joined: Fri Sep 14, 2012 9:34 pm

Date Picker issue with Parse DB

This is exactly what I needed! Thanks Max
precode
var d = (2012-10-09T18:40:29.679Z);
var d1 = d.substring(0,10);
console.log(d1);
var d2 = d1.split("-");
console.log(d2);
var d3 = d2[1] + "-" + d2[2] + "-" +d2[0];
console.log(d3);
return (d3);
/code/pre

Return to “Issues”