Bugfix: momentjs shortMonths can be array or function

This commit is contained in:
djmaze 2020-08-07 15:08:41 +02:00
parent b1678a1566
commit 6d29acb7eb
2 changed files with 12 additions and 7 deletions

View file

@ -75,20 +75,20 @@ Things might work in Edge 15-18, Firefox 47-62 and Chrome 54-68 due to one polyf
|admin.js |2.130.942 |1.216.173 | 485.481 | 298.376 |
|app.js |4.184.455 |2.961.284 | 932.725 | 691.792 |
|boot.js | 671.522 | 94.230 | 169.502 | 28.382 |
|libs.js | 647.614 | 458.564 | 194.728 | 139.408 |
|libs.js | 647.614 | 458.656 | 194.728 | 139.408 |
|polyfills.js | 325.834 | 0 | 71.825 | 0 |
|TOTAL js |7.960.367 |4.730.251 |1.854.261 |1.157.958 |
|TOTAL js |7.960.367 |4.730.343 |1.854.261 |1.157.958 |
|js/min/* |1.14.0 |native |gzip 1.14 |gzip |
|--------------- |--------: |--------: |--------: |--------: |
|admin.min.js | 252.147 | 156.868 | 73.657 | 44.788 |
|app.min.js | 511.202 | 384.861 |140.462 |101.677 |
|boot.min.js | 66.007 | 11.575 | 22.567 | 4.460 |
|libs.min.js | 572.545 | 413.893 |176.720 |129.076 |
|libs.min.js | 572.545 | 413.971 |176.720 |129.076 |
|polyfills.min.js | 32.452 | 0 | 11.312 | 0 |
|TOTAL js/min |1.434.353 | 967.197 |424.718 |280.001 |
|TOTAL js/min |1.434.353 | 967.275 |424.718 |280.001 |
467.156 bytes (144.717 gzip) is not much, but it feels faster.
467.078 bytes (144.717 gzip) is not much, but it feels faster.
|css/* |1.14.0 |native |

View file

@ -5,10 +5,15 @@
w.moment = {
defineLocale: (name, config)=>{
locale = config;
for (let i = 0; i < 12; ++i) Date.shortMonths[i] = config.monthsShort(i+1, 'MMM');
const m = config.monthsShort;
if (Array.isArray(m)) {
Date.shortMonths = m;
} else for (let i = 0; i < 12; ++i) {
Date.shortMonths[i] = config.monthsShort({month:()=>i}, '-MMM-');
}
Date.longMonths = config.months,
Date.longDays = config.weekdays;
Date.shortDays = config.weekdaysMin; // config.weekdaysShort
Date.shortDays = config.weekdaysMin;
}
};