I'm using moment.js to format a date I get from the db service.
It works fine if I test the app in the browser but doesn't work if I test my app on the phone.
var availableAtDate = moment(new Date(newData.availableAt)).calendar();
Any thoughts?
I'm using moment.js to format a date I get from the db service.
It works fine if I test the app in the browser but doesn't work if I test my app on the phone.
var availableAtDate = moment(new Date(newData.availableAt)).calendar();
Any thoughts?
Hi Shruti,
Please following JS code. Also you can check what actually you have in your availableAt data.
pre
var stringDate = newData.availableAt;
console.log("availableAt = " + stringDate);
console.log(new Date(stringDate));
var arrDate = stringDate.split(/[- :]/);
var date = new Date(arrDate[0], arrDate[1]-1, arrDate[2], arrDate[3], arrDate[4]);
var availableAtDate = moment(date).calendar();
/pre
Then open app with WEINRE debugger to see console.log from your ios device.
Regards.