turf-common 1.4.2-beta.41 → 1.4.2-beta.43

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.
@@ -9,6 +9,7 @@ export declare enum BookingHistoryOperationType {
9
9
  MERGED = "merged",
10
10
  DELETE_SLOT_EVENT = "delete_slot_event",
11
11
  EXTENSION = "extension",
12
- PAYMENT_WRITEOFF = "payment_writeoff"
12
+ PAYMENT_WRITEOFF = "payment_writeoff",
13
+ EXTENSION_MERGED = "extension_merged"
13
14
  }
14
15
  export declare const OPERATION_TYPES: BookingHistoryOperationType[];
@@ -14,6 +14,7 @@ var BookingHistoryOperationType;
14
14
  BookingHistoryOperationType["DELETE_SLOT_EVENT"] = "delete_slot_event";
15
15
  BookingHistoryOperationType["EXTENSION"] = "extension";
16
16
  BookingHistoryOperationType["PAYMENT_WRITEOFF"] = "payment_writeoff";
17
+ BookingHistoryOperationType["EXTENSION_MERGED"] = "extension_merged";
17
18
  })(BookingHistoryOperationType || (exports.BookingHistoryOperationType = BookingHistoryOperationType = {}));
18
19
  exports.OPERATION_TYPES = [
19
20
  BookingHistoryOperationType.DELETE,
@@ -145,4 +145,5 @@ export declare class BookingCode {
145
145
  */
146
146
  isAdjacentBookingCode(nextBookingCode: BookingCode): boolean;
147
147
  static getInstanceByComponents(turfId: number, pitchCode: number, dateCode: number, fromTimeCode: string, toTimeCode: string, priceCsv: string): BookingCode;
148
+ isTimeSlotContinuous(that: BookingCode): boolean;
148
149
  }
@@ -618,6 +618,12 @@ var BookingCode = /** @class */ (function () {
618
618
  BookingCode.getInstanceByComponents = function (turfId, pitchCode, dateCode, fromTimeCode, toTimeCode, priceCsv) {
619
619
  return new BookingCode("".concat(turfId.toString().padStart(4, "0")).concat(dateCode.toString().padStart(6, "0")).concat(fromTimeCode).concat(toTimeCode).concat(pitchCode.toString().padStart(2, "0")), priceCsv);
620
620
  };
621
+ BookingCode.prototype.isTimeSlotContinuous = function (that) {
622
+ return this.toTimeCode == that.fromTimeCode &&
623
+ this.pitchNumber == that.pitchNumber &&
624
+ this.turfId == that.turfId &&
625
+ this.dateCode == that.dateCode;
626
+ };
621
627
  /**
622
628
  * Extracts the numeric part of a bookingCode, excluding a predefined deleted slot separator.
623
629
  *
@@ -54,5 +54,10 @@ export declare class DateUtilService {
54
54
  */
55
55
  getBookingCodeByWeekDaysAndDateRange(startDateCode: string, endDateCode: string, weekdays: number[]): string[];
56
56
  formatDate(date: Date, formatString: string): string;
57
+ convertDateToTimezone(date: Date, timeZone: Timezone): Date;
58
+ convertDateToUTC(now: Date): Date;
59
+ }
60
+ export declare enum Timezone {
61
+ IST = "Asia/Kolkata"
57
62
  }
58
63
  export declare const dateUtilService: DateUtilService;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.dateUtilService = exports.DateUtilService = void 0;
3
+ exports.dateUtilService = exports.Timezone = exports.DateUtilService = void 0;
4
4
  var date_fns_1 = require("date-fns");
5
5
  var _model_1 = require("../@model");
6
6
  var DateUtilService = /** @class */ (function () {
@@ -159,7 +159,18 @@ var DateUtilService = /** @class */ (function () {
159
159
  DateUtilService.prototype.formatDate = function (date, formatString) {
160
160
  return (0, date_fns_1.format)(date, formatString);
161
161
  };
162
+ DateUtilService.prototype.convertDateToTimezone = function (date, timeZone) {
163
+ return new Date(date.toLocaleString("en-US", { timeZone: timeZone }));
164
+ // return new Date(date.getTime() + offset);
165
+ };
166
+ DateUtilService.prototype.convertDateToUTC = function (now) {
167
+ return new Date(now.getTime() + now.getTimezoneOffset() * 60 * 1000);
168
+ };
162
169
  return DateUtilService;
163
170
  }());
164
171
  exports.DateUtilService = DateUtilService;
172
+ var Timezone;
173
+ (function (Timezone) {
174
+ Timezone["IST"] = "Asia/Kolkata";
175
+ })(Timezone || (exports.Timezone = Timezone = {}));
165
176
  exports.dateUtilService = new DateUtilService();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "turf-common",
3
- "version": "1.4.2-beta.41",
3
+ "version": "1.4.2-beta.43",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",