Page 1 of 1

Get Month and Year from _createdAt date

Posted: Wed Jun 18, 2014 1:45 pm
by Bad Addy

I have the following code that works in the browser, but when its on the phone as an app it comes up with:

undefined NaNNaN

Where in the browser version of the app its:

June 2014

Here is the code which is tethered to the Add JS of the Mapping, onto a label:

pre
var d = new Date(value);
console.log(d);
var monthNames = [ "January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December" ];

return 'Member since ' + monthNames[d.getMonth()] + ' ' + d.getFullYear();
/pre

d = Tue Jun 17 2014 18:50:59 GMT+0100 (BST)

How do I make it work right with iOS and Android ?


Get Month and Year from _createdAt date

Posted: Wed Jun 18, 2014 3:17 pm
by Kateryna Grynko

Hi,

We have tested on iOS 7, it works for us. What is your iOS version? Please try running codealert(d)/code right after output to console. What is displayed in the alert?


Get Month and Year from _createdAt date

Posted: Wed Jun 18, 2014 3:49 pm
by Bad Addy

I am getting:

invalid date

Using this code:

pre
var d = new Date(value);
console.log(d);
alert(d);
var monthNames = [ "January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December" ];

return 'Member since ' + monthNames[d.getMonth()] + ' ' + d.getFullYear();
/pre


Get Month and Year from _createdAt date

Posted: Thu Jun 19, 2014 12:48 pm
by Evgene Karachevtsev

Addy,

Please look at this link:
https://getsatisfaction.com/apperyio/...