Page 2 of 2
How to format Data object received from REST database ?
Posted: Tue Apr 01, 2014 10:55 pm
by Igor
Please try the following code:
pre
code
var d = value;
console.log(d);
var d2 = new Date(d);
console.log(d2.toDateString());
return d2.toDateString();
/code
/pre
How to format Data object received from REST database ?
Posted: Tue Apr 01, 2014 11:10 pm
by Matt6607699
I replaced my code with what you posted and it's still returning an invalid date in the console.log(d); and in the day label that the value is mapped to.
How to format Data object received from REST database ?
Posted: Wed Apr 02, 2014 12:28 am
by Igor
Matt,
This code is working for me. You can test this code using static values. Also, please try to clear browser cache.
How to format Data object received from REST database ?
Posted: Wed Apr 02, 2014 1:48 am
by Matt6607699
Hey, thanks for the help,
I came across this discussion and used it do get what I needed:
https://getsatisfaction.com/apperyio/...
The code I used for anyone that needs it:
var d = new Date(value.split(" ")[0]);
console.log(d); //logs "Date {Sat Mar 29 2014 20:00:00 GMT-0400 (EDT)}"
var x = d.toDateString();
console.log(x); // logs "Sat Mar 29 2014"
return x;
How to format Data object received from REST database ?
Posted: Sat Apr 19, 2014 3:53 pm
by bahar.wadia
I am starting to have this same problem, as Matt. Something is now broken with Appery!
How to format Data object received from REST database ?
Posted: Sat Apr 19, 2014 4:56 pm
by Alena Prykhodko
Please provide us with more details, error screen shots will help.
How to format Data object received from REST database ?
Posted: Mon May 05, 2014 4:26 am
by bahar.wadia
I am getting the following date value returned to me "2014-05-01T00:00:00.000Z". What is the T and Z for?
Then I get an invalid date when I pass the value to Date()
How to format Data object received from REST database ?
Posted: Mon May 05, 2014 8:10 am
by Evgene Karachevtsev
Hello Bahar,
The date in our base is in ISO 8601 format
http://docs.appery.io/documentation/b...
http://www.w3.org/TR/NOTE-datetime
And such code: code d = new Date('2014-05-05T01:00:10.000Z'); /code
Should work without errors