I've got a big problem with Twitter API created_at date, which has got following format: Tue Apr 18 07:24:05 +0000 2017
... I want to create javascript Date object from that, but I'm not able to find cross-browser solution. What I've tried so far:
new Date(Date.parse(input.replace(/( \+)/, ' UTC$1')));
– returns null in Safarinew Date((input || "").replace(/-/g,"/").replace(/[TZ]/g," "));
– returns null in IE11Can someone help me to figure it out? Thank you very much!
follow these 2 links
How to format Twitter/Facebook feed date with JavaScript
JavaScript code to display Twitter created_at as xxxx ago
OR USE momentjs.com
> var tweetDate = 'Mon Dec 02 23:45:49 +0000 2013'; moment(tweetDate,
> 'dd MMM DD HH:mm:ss ZZ YYYY', 'en');