@citygross/components 0.7.227 → 0.7.228

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.
@@ -389,6 +389,18 @@ var makeCateringPortionsString = function (variant, cartItem, unit) {
389
389
 
390
390
  var formatLeadingZero = function (day) { return day.replace(/^0+/, ''); };
391
391
 
392
+ var formatPostalCode = function (postalCode, spaceIndex) {
393
+ var _a;
394
+ if (!(postalCode === null || postalCode === void 0 ? void 0 : postalCode.length))
395
+ return null;
396
+ return (_a = postalCode.split('')) === null || _a === void 0 ? void 0 : _a.reduce(function (acc, curr, index) {
397
+ if (index === (spaceIndex || 3)) {
398
+ return "".concat(acc, " ").concat(curr);
399
+ }
400
+ return "".concat(acc).concat(curr);
401
+ });
402
+ };
403
+
392
404
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof commonjsGlobal$1 !== 'undefined' ? commonjsGlobal$1 : typeof self !== 'undefined' ? self : {};
393
405
 
394
406
  function commonjsRequire (path) {
@@ -18656,10 +18668,17 @@ var Locale;
18656
18668
  })(Locale || (Locale = {}));
18657
18669
  moment.locale(Locale.swedish);
18658
18670
 
18671
+ var formatDateToLocale = function (date, withYear) {
18672
+ var _a, _b;
18673
+ return (_b = (_a = moment(new Date(date))) === null || _a === void 0 ? void 0 : _a.format("dddd D MMMM ".concat(withYear ? 'YYYY' : ''))) === null || _b === void 0 ? void 0 : _b.toLocaleLowerCase();
18674
+ };
18675
+
18659
18676
  build.capitalizeFirstLetter = capitalizeFirstLetter;
18660
18677
  build.comparisonTypes = comparisonTypes;
18661
18678
  build.emailRegex = emailRegex;
18679
+ build.formatDateToLocale = formatDateToLocale;
18662
18680
  build.formatLeadingZero = formatLeadingZero;
18681
+ build.formatPostalCode = formatPostalCode;
18663
18682
  build.formatPrice = formatPrice;
18664
18683
  build.formatPriceWithDecimalsReduced = formatPriceWithDecimalsReduced;
18665
18684
  build.getCountryFromLanguageCode = getCountryFromLanguageCode;