@citygross/components 0.7.215 → 0.7.217

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.
@@ -12,23 +12,14 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
12
12
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
13
13
 
14
14
  function DeliveryTimeBlock(_a) {
15
- var deliveryDate = _a.deliveryDate, deliveryFromTime = _a.deliveryFromTime, deliveryToTime = _a.deliveryToTime, icon = _a.icon, _b = _a.localTimeVar, localTimeVar = _b === void 0 ? 'kl' : _b, deliverOption = _a.deliverOption, children = _a.children;
16
- var momentDeliveryDate = utils.moment(deliveryDate);
17
- var day = momentDeliveryDate.format('dddd');
18
- day = day.slice(0, 1).toLocaleUpperCase() + day.slice(1);
19
- var date = momentDeliveryDate.format('D');
20
- var month = momentDeliveryDate.format('MMMM');
21
- month = month.slice(0, 1).toLocaleUpperCase() + month.slice(1);
15
+ var _b, _c;
16
+ var deliveryDate = _a.deliveryDate, deliveryFromTime = _a.deliveryFromTime, deliveryToTime = _a.deliveryToTime, icon = _a.icon, _d = _a.localTimeVar, localTimeVar = _d === void 0 ? 'kl' : _d, deliverOption = _a.deliverOption, children = _a.children;
22
17
  return (React__default["default"].createElement(DeliveryTimeBlock_styles.DeliveryTimeBlock, null,
23
18
  React__default["default"].createElement(DeliveryTimeBlock_styles.DeliverOption, null,
24
19
  icon && icon,
25
20
  deliverOption && React__default["default"].createElement(typography.H3, null, deliverOption)),
26
- React__default["default"].createElement(typography.BodyText, null,
27
- day,
28
- " ",
29
- date,
30
- " ",
31
- month,
21
+ React__default["default"].createElement(typography.BodyText, null, (_c = (_b = utils.moment(deliveryDate)) === null || _b === void 0 ? void 0 : _b.format('dddd D MMM')) === null || _c === void 0 ? void 0 :
22
+ _c.toLocaleLowerCase(),
32
23
  ' ',
33
24
  deliveryFromTime && deliveryToTime && (React__default["default"].createElement("span", { style: { whiteSpace: 'nowrap' } }, "".concat(localTimeVar, " ").concat(deliveryFromTime, " - ").concat(deliveryToTime)))),
34
25
  children));
@@ -1 +1 @@
1
- {"version":3,"file":"DeliveryTimeBlock.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"DeliveryTimeBlock.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -22,9 +22,9 @@ var formatPrice = function (price, withParenthesis) {
22
22
  if (price === null || price === undefined) {
23
23
  return;
24
24
  }
25
- var formattedPrice = (Math.round(price * 100) / 100)
26
- .toFixed(2)
27
- .replace('.', ',');
25
+ var formattedPrice = price === 0
26
+ ? 0
27
+ : (Math.round(price * 100) / 100).toFixed(2).replace('.', ',');
28
28
  return "".concat(withParenthesis ? "(".concat(formattedPrice, " kr)") : "".concat(formattedPrice, " kr"));
29
29
  };
30
30