turf-common 1.2.1-beta.71 → 1.2.1-beta.73
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.
|
@@ -113,4 +113,11 @@ export declare class BookingCode {
|
|
|
113
113
|
toDateCode: string;
|
|
114
114
|
};
|
|
115
115
|
static getTotalTimeByBookingCodes(bookingCodes: BookingCode[]): number;
|
|
116
|
+
/**
|
|
117
|
+
* Retrieves booking codes for a booking scenario that may span across different days.
|
|
118
|
+
* If the booking spans multiple days, two codes are generated for each day; otherwise, a single code is used.
|
|
119
|
+
*
|
|
120
|
+
* @returns {string[]} An array containing the booking codes.
|
|
121
|
+
*/
|
|
122
|
+
getBookingCodesByAcrossDateBookingCode(): string[];
|
|
116
123
|
}
|
|
@@ -556,6 +556,26 @@ var BookingCode = /** @class */ (function () {
|
|
|
556
556
|
});
|
|
557
557
|
return totalBookingHours;
|
|
558
558
|
};
|
|
559
|
+
/**
|
|
560
|
+
* Retrieves booking codes for a booking scenario that may span across different days.
|
|
561
|
+
* If the booking spans multiple days, two codes are generated for each day; otherwise, a single code is used.
|
|
562
|
+
*
|
|
563
|
+
* @returns {string[]} An array containing the booking codes.
|
|
564
|
+
*/
|
|
565
|
+
BookingCode.prototype.getBookingCodesByAcrossDateBookingCode = function () {
|
|
566
|
+
var bookingCodes = [];
|
|
567
|
+
// Check if the booking spans across different days
|
|
568
|
+
if (this.fromTimeCode > this.toTimeCode) {
|
|
569
|
+
var firstDayCode = "".concat(this.turfId).concat(this.dateCode).concat(this.fromTimeCode, "2400").concat(this.pitchCode);
|
|
570
|
+
var secondDayCode = "".concat(this.turfId).concat(date_util_1.dateUtilService.addNDaysToDateCode(this.dateCode, 1), "0000").concat(this.toTimeCode).concat(this.pitchCode);
|
|
571
|
+
bookingCodes.push(firstDayCode);
|
|
572
|
+
bookingCodes.push(secondDayCode);
|
|
573
|
+
}
|
|
574
|
+
else {
|
|
575
|
+
bookingCodes.push(this.code);
|
|
576
|
+
}
|
|
577
|
+
return bookingCodes;
|
|
578
|
+
};
|
|
559
579
|
/**
|
|
560
580
|
* Extracts the numeric part of a bookingCode, excluding a predefined deleted slot separator.
|
|
561
581
|
*
|
|
@@ -44,5 +44,6 @@ export declare class DateUtilService {
|
|
|
44
44
|
* @returns An array of booking date codes based on the provided date range and weekdays.
|
|
45
45
|
*/
|
|
46
46
|
getBookingCodeByWeekDaysAndDateRange(startDateCode: string, endDateCode: string, weekdays: number[]): string[];
|
|
47
|
+
formatDate(date: Date, formatString: string): string;
|
|
47
48
|
}
|
|
48
49
|
export declare const dateUtilService: DateUtilService;
|
package/build/utils/date-util.js
CHANGED
|
@@ -138,6 +138,9 @@ var DateUtilService = /** @class */ (function () {
|
|
|
138
138
|
});
|
|
139
139
|
return bookingDateCodes.map(Number).sort().map(String);
|
|
140
140
|
};
|
|
141
|
+
DateUtilService.prototype.formatDate = function (date, formatString) {
|
|
142
|
+
return (0, date_fns_1.format)(date, formatString);
|
|
143
|
+
};
|
|
141
144
|
return DateUtilService;
|
|
142
145
|
}());
|
|
143
146
|
exports.DateUtilService = DateUtilService;
|