Bad Addy
Posts: 0
Joined: Fri Dec 13, 2013 9:34 pm

Get Month and Year from _createdAt date

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 ?

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

Get Month and Year from _createdAt date

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?

Bad Addy
Posts: 0
Joined: Fri Dec 13, 2013 9:34 pm

Get Month and Year from _createdAt date

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

Return to “Issues”