@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.js CHANGED
@@ -36318,10 +36318,20 @@ var defaultPresets$1 = [{
36318
36318
  function formatDate(date) {
36319
36319
  var format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'MM/dd/yyyy';
36320
36320
  if (!date) return '';
36321
+ var monthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
36321
36322
  var month = String(date.getMonth() + 1).padStart(2, '0');
36323
+ var monthShort = monthNames[date.getMonth()];
36322
36324
  var day = String(date.getDate()).padStart(2, '0');
36323
36325
  var year = date.getFullYear();
36324
- return format.replace('MM', month).replace('dd', day).replace('yyyy', String(year));
36326
+ // Replace longer tokens first using placeholders to avoid substring conflicts
36327
+ // (e.g. 'MMM' contains 'MM', so naive chaining can break)
36328
+ var result = format;
36329
+ if (result.includes('MMM')) {
36330
+ result = result.replace('MMM', monthShort);
36331
+ } else {
36332
+ result = result.replace('MM', month);
36333
+ }
36334
+ return result.replace('dd', day).replace('yyyy', String(year));
36325
36335
  }
36326
36336
  function isSameDay(date1, date2) {
36327
36337
  if (!date1 || !date2) return false;