@moving-walls/design-system 1.0.20 → 1.0.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -36298,10 +36298,20 @@ var defaultPresets$1 = [{
36298
36298
  function formatDate(date) {
36299
36299
  var format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'MM/dd/yyyy';
36300
36300
  if (!date) return '';
36301
+ var monthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
36301
36302
  var month = String(date.getMonth() + 1).padStart(2, '0');
36303
+ var monthShort = monthNames[date.getMonth()];
36302
36304
  var day = String(date.getDate()).padStart(2, '0');
36303
36305
  var year = date.getFullYear();
36304
- return format.replace('MM', month).replace('dd', day).replace('yyyy', String(year));
36306
+ // Replace longer tokens first using placeholders to avoid substring conflicts
36307
+ // (e.g. 'MMM' contains 'MM', so naive chaining can break)
36308
+ var result = format;
36309
+ if (result.includes('MMM')) {
36310
+ result = result.replace('MMM', monthShort);
36311
+ } else {
36312
+ result = result.replace('MM', month);
36313
+ }
36314
+ return result.replace('dd', day).replace('yyyy', String(year));
36305
36315
  }
36306
36316
  function isSameDay(date1, date2) {
36307
36317
  if (!date1 || !date2) return false;