turf-common 1.2.1-beta.72 → 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
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "turf-common",
3
- "version": "1.2.1-beta.72",
3
+ "version": "1.2.1-beta.73",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",