• New Date object in JavaScript, NaN (invalid Date) appears on safari and iphone!


    1. The problem is as follows When using the Date object in JavaScript, on browsers such as safari and iphone, the time cannot be displayed correctly, but “NaN” is displayed. var date = new Date(“2018-11-30T03:04:01+0100”); 2. Solutions Use moment.js in node.js to process time as follows: const moment = require(‘moment’) moment(“2018-11-30T03:04:01+0100”).format(‘YYYY HH:mm:ss’); // Output result: […]