ISO time incompatibility problem

1. Get time from the database, Google browser and Android display normally, but when it comes to Apple"s browser, it shows NaN
the following is the code for time conversion:

   

Mar.03,2022

Time.replace(/-/g, '/');

// ps: ......

// 
safari

clipboard.png


timeStr = timeStr.replace(/-/g, '/')
ios


iosnewDate()string"-"


ars_qu moment2019-10-31T16:00:00.000+0000


rewrite Date https://www.jianshu.com/p/dc8.

     /**
     * SafariIE8 new Date('2017-12-8 11:36:45'); Invalid Date
     * DateSafariIE8bug
     */
    Date = function (Date) {
      MyDate.prototype = Date.prototype;
      return MyDate;

      function MyDate() {
        // -/
        if (arguments.length === 1) {
          let arg = arguments[0];
          if (Object.prototype.toString.call(arg) === '[object String]' && arg.indexOf('T') === -1) {
            arguments[0] = arg.replace(/-/g, "/");
            // console.log(arguments[0]);
          }
        }
        let bind = Function.bind;
        let unbind = bind.bind(bind);
        return new (unbind(Date, null).apply(null, arguments));
      }
    }(Date);
Menu