Page 1 of 1

Date Picker issue with Parse DB

Posted: Fri Sep 14, 2012 9:34 pm
by egonzalez

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


Date Picker issue with Parse DB

Posted: Fri Sep 14, 2012 10:58 pm
by maxkatz

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?


Date Picker issue with Parse DB

Posted: Sat Sep 15, 2012 2:06 am
by egonzalez

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? =)


Date Picker issue with Parse DB

Posted: Sat Sep 15, 2012 2:17 am
by maxkatz

Parse creates a record with today's date?


Date Picker issue with Parse DB

Posted: Thu Oct 04, 2012 12:40 am
by egonzalez

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


Date Picker issue with Parse DB

Posted: Thu Oct 04, 2012 12:58 am
by maxkatz

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


Date Picker issue with Parse DB

Posted: Thu Oct 11, 2012 1:04 am
by egonzalez

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


Date Picker issue with Parse DB

Posted: Thu Oct 11, 2012 2:55 am
by maxkatz

Date Picker issue with Parse DB

Posted: Tue Oct 16, 2012 3:12 pm
by egonzalez

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