turf-common 1.2.1-beta.57 → 1.2.1-beta.58

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.
@@ -50,7 +50,7 @@ export declare class TurfAvailability implements ITurfAvailability {
50
50
  endDateCode: string;
51
51
  fromTimeCode: string;
52
52
  toTimeCode: string;
53
- weekDays: number[];
53
+ bookingDateCodes: string[];
54
54
  };
55
55
  }
56
56
  export {};
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TurfAvailability = void 0;
4
+ var _utils_1 = require("../@utils");
4
5
  var booking_code_model_1 = require("./booking-code-model");
5
6
  var TurfAvailability = /** @class */ (function () {
6
7
  function TurfAvailability(data) {
@@ -193,13 +194,17 @@ var TurfAvailability = /** @class */ (function () {
193
194
  var eventCodes = eventCode.split("#");
194
195
  var dateCodeRange = eventCodes[1];
195
196
  var timeCodeRange = eventCodes[2];
197
+ var weekDays = ((_a = eventCodes[4]) === null || _a === void 0 ? void 0 : _a.split(",").map(Number)) || -1;
198
+ var startDateCode = dateCodeRange.slice(0, 6);
199
+ var endDateCode = dateCodeRange.slice(6, 12);
200
+ var bookingDateCodes = _utils_1.dateUtilService.getBookingCodeByWeekDaysAndDateRange(startDateCode, endDateCode, weekDays);
196
201
  return {
197
202
  pitchCodes: eventCodes[3].split(",").map(function (id) { return id.padStart(2, "0"); }),
198
- startDateCode: dateCodeRange.slice(0, 6),
199
- endDateCode: dateCodeRange.slice(6, 12),
203
+ startDateCode: startDateCode,
204
+ endDateCode: endDateCode,
200
205
  fromTimeCode: timeCodeRange.slice(0, 4),
201
206
  toTimeCode: timeCodeRange.slice(4, 8),
202
- weekDays: ((_a = eventCodes[4]) === null || _a === void 0 ? void 0 : _a.split(",").map(Number)) || -1,
207
+ bookingDateCodes: bookingDateCodes,
203
208
  };
204
209
  };
205
210
  return TurfAvailability;
@@ -136,7 +136,7 @@ var DateUtilService = /** @class */ (function () {
136
136
  var endDateCodeCopy = Number(endDateCode);
137
137
  bookingDateCodes.push.apply(bookingDateCodes, _model_1.BookingCode.getDateCodesByWeek(startDateCodeCopy, endDateCodeCopy, weekDay));
138
138
  });
139
- return bookingDateCodes;
139
+ return bookingDateCodes.map(Number).sort().map(String);
140
140
  };
141
141
  return DateUtilService;
142
142
  }());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "turf-common",
3
- "version": "1.2.1-beta.57",
3
+ "version": "1.2.1-beta.58",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",