turf-common 1.4.2-beta.48 → 1.4.2-beta.49

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.
@@ -37,6 +37,8 @@ export declare class BookingCode {
37
37
  [time: string]: number;
38
38
  };
39
39
  }): number;
40
+ getToDate(): Date;
41
+ isAcrossDate(): boolean;
40
42
  isModificationAllowed(delayInMinutes?: number): boolean;
41
43
  isDeletionAllowed(delayInMinutes?: number): boolean;
42
44
  isCreationAllowed(delayInMinutes?: number): boolean;
@@ -109,6 +109,12 @@ var BookingCode = /** @class */ (function () {
109
109
  }
110
110
  return price;
111
111
  };
112
+ BookingCode.prototype.getToDate = function () {
113
+ return date_util_1.dateUtilService.convertStringToDate(this.getDateWithToTimeCode(), "yyMMddHHmm");
114
+ };
115
+ BookingCode.prototype.isAcrossDate = function () {
116
+ return this.fromTimeCode > this.toTimeCode;
117
+ };
112
118
  BookingCode.prototype.isModificationAllowed = function (delayInMinutes) {
113
119
  if (delayInMinutes === void 0) { delayInMinutes = _utils_1.DEFAULT_BOOKING_MODIFICATION_DELAY_IN_MINUTES; }
114
120
  var dateWithToTimeCode = this.getDateWithToTimeCode();
@@ -116,7 +122,7 @@ var BookingCode = /** @class */ (function () {
116
122
  if (dateWithToTimeCode.slice(-4) === _utils_1.END_OF_DAY_TIME_CODE) {
117
123
  dateWithToTimeCode = dateWithToTimeCode.slice(0, -4) + "2359";
118
124
  }
119
- var bookingToDateTimeWithDelay = date_util_1.dateUtilService.addMinutesTo(date_util_1.dateUtilService.convertStringToDate(dateWithToTimeCode, "yyMMddHHmm"), delayInMinutes);
125
+ var bookingToDateTimeWithDelay = date_util_1.dateUtilService.addMinutesTo(this.getToDate(), delayInMinutes + (this.isAcrossDate() ? 24 * 60 : 0));
120
126
  var currentTime = date_util_1.dateUtilService.getIndianDate();
121
127
  return bookingToDateTimeWithDelay > currentTime;
122
128
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "turf-common",
3
- "version": "1.4.2-beta.48",
3
+ "version": "1.4.2-beta.49",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",