The _createdAt field is mapped to a label on a list.
I have the js on the mapping.
pre
var date = new Date(value);
var hour = date.getHours();
date.setHours(hour);
var diff = ((((new Date()).getTime() - date.getTime()) / 1000)-3600); //-3600 is for time difference reasons
var day_diff = Math.floor(diff / 86400);
console.log("dif type "+typeof diff);
console.log("dif "+ diff);
console.log("day diff type "+typeof day_diff);
console.log("day diff "+ day_diff);
if (day_diff < 1){
if (diff < 60){
return "just now";
}
if (diff < 120){
return "1m";
}
if (diff < 3600){
min = Math.floor( diff / 60 );
return min+ "m";
Code: Select all
}
if (diff < 7200){
return "1hr";
}
Code: Select all
if (diff < 86400){
hr = Math.floor( diff / 3600 );
return hr + "hr";
}
}
else {
return day_diff + "d";
}
/pre
When I test it on chrome it works as expected.
but when i test it on the appery test app on my iphone it returns 'NaNd' for every item.
Therefore it is not recognising day_diff to be a number.
I added
pre console.log(typeof day_diff);
console.log(typeof diff); /pre
to this code and it showed
'number
number'.
I also tried using parseInt(), but that didnt work either
how do i get it to recognise it as a number on iphone?
please note, it works on chrome correctly, but not the appery test app iphone.
Thank you for all your help so far.