function checkDate(date) {
        if (!date) return;
        if (date.calendar.name !== calendar.name) date.setCalendar(calendar);
        if (date.locale.name !== locale.name) date.setLocale(locale);
        if (date._format !== format) date.setFormat(format);

        date.digits = digits;
        date.ignoreList = JSON.parse(formattingIgnoreList);

        return date;
      }
Each plugin can return several different plugins.
So in the first place, plugins might look like this:
[plugin1, [plugin2, plugin3], plugin4]
For this reason, we remove the extra arrays inside the plugins.