@propeller-commerce/propeller-v2-react-ui 0.4.22 → 0.4.24

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/pure.js CHANGED
@@ -426,15 +426,18 @@ function OrderSummary(props) {
426
426
  }
427
427
  return formatPrice(price || 0, { symbol: props.currency ?? "\u20AC" });
428
428
  }
429
+ function numericDate(dateString) {
430
+ const d = new Date(dateString);
431
+ if (isNaN(d.getTime())) return dateString;
432
+ const day = String(d.getDate()).padStart(2, "0");
433
+ const month = String(d.getMonth() + 1).padStart(2, "0");
434
+ return `${day}-${month}-${d.getFullYear()}`;
435
+ }
429
436
  function formatOrderDate(dateString) {
430
437
  if (props.formatDate) {
431
438
  return props.formatDate(dateString);
432
439
  }
433
- try {
434
- return new Date(dateString).toLocaleDateString("en-US");
435
- } catch {
436
- return dateString;
437
- }
440
+ return numericDate(dateString);
438
441
  }
439
442
  const requestDateRaw = order?.postageData?.requestDate;
440
443
  let requestDate = "";
@@ -442,11 +445,7 @@ function OrderSummary(props) {
442
445
  if (props.formatDate) {
443
446
  requestDate = props.formatDate(requestDateRaw);
444
447
  } else {
445
- try {
446
- requestDate = new Date(requestDateRaw).toLocaleDateString("en-US");
447
- } catch {
448
- requestDate = requestDateRaw;
449
- }
448
+ requestDate = numericDate(requestDateRaw);
450
449
  }
451
450
  }
452
451
  const getCountryName$1 = (code) => getCountryName(code, props.countries);