Answer the question
In order to leave comments, you need to log in
Mobile browsers give Invalid Date when parsing GMT format - how to format date?
I get a string Wed Dec 20 2017 13:43:03 GMT+0300
, on desktops it is perfectly parsed using Date.parse (), but in mobile browsers the method returns Invalid Date.
How else can you turn this string into milliseconds?
Answer the question
In order to leave comments, you need to log in
In order not to fence the bike, you can use ready-made solutions. Most Searched:
https://www.npmjs.com/package/moment
momentjs.com/docs/#/parsing/string
var moment = require('moment');
var day = moment("Wed Dec 20 2017 13:43:03 GMT+0300");
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question