@pisell/pisellos 0.10.38 → 0.10.39
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.
|
@@ -1620,15 +1620,18 @@ function formatVoucherValidityRange(startValue, endValue, locale) {
|
|
|
1620
1620
|
var times = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
1621
1621
|
var start = combineVoucherDateAndTime(startValue, times.startTime);
|
|
1622
1622
|
var end = combineVoucherDateAndTime(endValue, times.endTime);
|
|
1623
|
-
var
|
|
1624
|
-
var
|
|
1625
|
-
if (
|
|
1623
|
+
var startPart = formatVoucherValidityDate(start, locale);
|
|
1624
|
+
var endPart = formatVoucherValidityDate(end, locale);
|
|
1625
|
+
if (startPart.text && endPart.text) {
|
|
1626
1626
|
var parsedStart = dayjs(start);
|
|
1627
1627
|
var parsedEnd = dayjs(end);
|
|
1628
1628
|
var sameDay = parsedStart.isValid() && parsedEnd.isValid() && parsedStart.isSame(parsedEnd, 'day');
|
|
1629
|
-
|
|
1629
|
+
if (sameDay && startPart.time && endPart.time) {
|
|
1630
|
+
return "".concat(startPart.time, " - ").concat(endPart.time, " ").concat(startPart.date);
|
|
1631
|
+
}
|
|
1632
|
+
return "".concat(startPart.text, " - ").concat(endPart.text);
|
|
1630
1633
|
}
|
|
1631
|
-
return
|
|
1634
|
+
return startPart.text || endPart.text;
|
|
1632
1635
|
}
|
|
1633
1636
|
function combineVoucherDateAndTime(dateValue, timeValue) {
|
|
1634
1637
|
if (!isPresentId(dateValue) || !isPresentId(timeValue)) return dateValue;
|
|
@@ -1637,13 +1640,26 @@ function combineVoucherDateAndTime(dateValue, timeValue) {
|
|
|
1637
1640
|
return "".concat(dateText, " ").concat(stringify(timeValue).trim());
|
|
1638
1641
|
}
|
|
1639
1642
|
function formatVoucherValidityDate(value, locale) {
|
|
1640
|
-
if (!isPresentId(value)) return
|
|
1643
|
+
if (!isPresentId(value)) return {
|
|
1644
|
+
date: '',
|
|
1645
|
+
time: '',
|
|
1646
|
+
text: ''
|
|
1647
|
+
};
|
|
1641
1648
|
var source = stringify(value).trim();
|
|
1642
1649
|
var parsed = dayjs(source);
|
|
1643
|
-
if (!parsed.isValid()) return
|
|
1650
|
+
if (!parsed.isValid()) return {
|
|
1651
|
+
date: '',
|
|
1652
|
+
time: '',
|
|
1653
|
+
text: source
|
|
1654
|
+
};
|
|
1644
1655
|
var hasTime = /\d{1,2}:\d{2}/.test(source);
|
|
1645
|
-
|
|
1646
|
-
|
|
1656
|
+
var date = parsed.format(locale === 'en' ? 'DD/MM/YYYY' : 'YYYY/MM/DD');
|
|
1657
|
+
var time = hasTime ? parsed.format(/\d{1,2}:\d{2}:\d{2}/.test(source) ? 'HH:mm:ss' : 'HH:mm') : '';
|
|
1658
|
+
return {
|
|
1659
|
+
date: date,
|
|
1660
|
+
time: time,
|
|
1661
|
+
text: time ? "".concat(time, " ").concat(date) : date
|
|
1662
|
+
};
|
|
1647
1663
|
}
|
|
1648
1664
|
function getVoucherAssetKey(voucher, index) {
|
|
1649
1665
|
var identity = firstPresentValue(voucher.voucher_id, voucher.id, voucher.code, voucher.encoded);
|
|
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
326
326
|
date: string;
|
|
327
327
|
status: string;
|
|
328
328
|
week: string;
|
|
329
|
-
weekNum: 0 | 1 | 2 |
|
|
329
|
+
weekNum: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
330
330
|
}[]>;
|
|
331
331
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
332
332
|
private getScheduleDataByIds;
|
|
@@ -1503,15 +1503,18 @@ function formatVoucherAvailableTime(value, locale) {
|
|
|
1503
1503
|
function formatVoucherValidityRange(startValue, endValue, locale, times = {}) {
|
|
1504
1504
|
const start = combineVoucherDateAndTime(startValue, times.startTime);
|
|
1505
1505
|
const end = combineVoucherDateAndTime(endValue, times.endTime);
|
|
1506
|
-
const
|
|
1507
|
-
const
|
|
1508
|
-
if (
|
|
1506
|
+
const startPart = formatVoucherValidityDate(start, locale);
|
|
1507
|
+
const endPart = formatVoucherValidityDate(end, locale);
|
|
1508
|
+
if (startPart.text && endPart.text) {
|
|
1509
1509
|
const parsedStart = (0, _dayjs.default)(start);
|
|
1510
1510
|
const parsedEnd = (0, _dayjs.default)(end);
|
|
1511
1511
|
const sameDay = parsedStart.isValid() && parsedEnd.isValid() && parsedStart.isSame(parsedEnd, 'day');
|
|
1512
|
-
|
|
1512
|
+
if (sameDay && startPart.time && endPart.time) {
|
|
1513
|
+
return `${startPart.time} - ${endPart.time} ${startPart.date}`;
|
|
1514
|
+
}
|
|
1515
|
+
return `${startPart.text} - ${endPart.text}`;
|
|
1513
1516
|
}
|
|
1514
|
-
return
|
|
1517
|
+
return startPart.text || endPart.text;
|
|
1515
1518
|
}
|
|
1516
1519
|
function combineVoucherDateAndTime(dateValue, timeValue) {
|
|
1517
1520
|
if (!isPresentId(dateValue) || !isPresentId(timeValue)) return dateValue;
|
|
@@ -1520,13 +1523,26 @@ function combineVoucherDateAndTime(dateValue, timeValue) {
|
|
|
1520
1523
|
return `${dateText} ${stringify(timeValue).trim()}`;
|
|
1521
1524
|
}
|
|
1522
1525
|
function formatVoucherValidityDate(value, locale) {
|
|
1523
|
-
if (!isPresentId(value)) return
|
|
1526
|
+
if (!isPresentId(value)) return {
|
|
1527
|
+
date: '',
|
|
1528
|
+
time: '',
|
|
1529
|
+
text: ''
|
|
1530
|
+
};
|
|
1524
1531
|
const source = stringify(value).trim();
|
|
1525
1532
|
const parsed = (0, _dayjs.default)(source);
|
|
1526
|
-
if (!parsed.isValid()) return
|
|
1533
|
+
if (!parsed.isValid()) return {
|
|
1534
|
+
date: '',
|
|
1535
|
+
time: '',
|
|
1536
|
+
text: source
|
|
1537
|
+
};
|
|
1527
1538
|
const hasTime = /\d{1,2}:\d{2}/.test(source);
|
|
1528
|
-
|
|
1529
|
-
|
|
1539
|
+
const date = parsed.format(locale === 'en' ? 'DD/MM/YYYY' : 'YYYY/MM/DD');
|
|
1540
|
+
const time = hasTime ? parsed.format(/\d{1,2}:\d{2}:\d{2}/.test(source) ? 'HH:mm:ss' : 'HH:mm') : '';
|
|
1541
|
+
return {
|
|
1542
|
+
date,
|
|
1543
|
+
time,
|
|
1544
|
+
text: time ? `${time} ${date}` : date
|
|
1545
|
+
};
|
|
1530
1546
|
}
|
|
1531
1547
|
function getVoucherAssetKey(voucher, index) {
|
|
1532
1548
|
const identity = firstPresentValue(voucher.voucher_id, voucher.id, voucher.code, voucher.encoded);
|
|
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
326
326
|
date: string;
|
|
327
327
|
status: string;
|
|
328
328
|
week: string;
|
|
329
|
-
weekNum: 0 | 1 | 2 |
|
|
329
|
+
weekNum: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
330
330
|
}[]>;
|
|
331
331
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
332
332
|
private getScheduleDataByIds;
|