2

I'm migrating my old code from momentJS for the dayJS.

isValidTimestampDateTime: function (date) {

    const datetimeFormats = [
        "YYYY-MM-DDTHH:mm:ssZ", // 2023-03-01T15:41:00+01:00
        "YYYY-MM-DDTHH:mm:ss.SSSZ", // 2023-03-22T11:51:53.766+01:00
        "YYYY-MM-DDTHH:mm:ss[Z]", // 2023-03-22T11:51:53.766Z
    ];

    return dayjs(date, datetimeFormats, true).isValid();
},

Why this return always false? In momentJS always worked even with the strict params. Now, only returns true to them if the strict param isn't filled.

Maykel Esser
  • 289
  • 3
  • 15

1 Answers1

1

Is a version issue. I was using 1.1.17. In the 1.1.19, it actually works.

Maykel Esser
  • 289
  • 3
  • 15