I'm trying to achieve this date format..
I'm getting my date from back-end, but its in server time. It looks like this
var d.date = "2017-04-26 07:49:09"
Then, I'm formatting it so date constructor would accept the format properly
var dateFormated = d.date.replace(' ', 'T');
Then, out of it I'm constructing my date object as follows:
var dateplublished = new Date(dateFormated);
Which gives me the following result :
Wed Apr 26 2017 07:49:09 GMT+0300 (Eastern Europe Daylight Time)
Everything seems to be fine, except that the GMT +0300 won't add. It supposed to spit out :
Wed Apr 26 2017 10:49:09 GMT+0300 (Eastern Europe Daylight Time)
How can I achieve this, so it Would be supported in all major browsers including ios safari etc? I managed to do it before, by doing it like so :
var dateFormated = d.date;
var dateplublished = new Date(dateFormated + " " + "UTC");
This way it would spit out everything perfectly, except that it would show NaN-NaN-NaN on ios safari/chrome.