turf-common 1.2.1-beta.30 → 1.2.1-beta.32

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.
@@ -5,6 +5,7 @@ export declare enum BookingHistoryOperationType {
5
5
  DELETE_INSERT = "delete_insert",
6
6
  DELETE_SLOT = "delete_slot",
7
7
  REFUND = "refund",
8
- PAYMENT = "payment"
8
+ PAYMENT = "payment",
9
+ MERGED = "merged"
9
10
  }
10
11
  export declare const operationTypes: BookingHistoryOperationType[];
@@ -10,6 +10,7 @@ var BookingHistoryOperationType;
10
10
  BookingHistoryOperationType["DELETE_SLOT"] = "delete_slot";
11
11
  BookingHistoryOperationType["REFUND"] = "refund";
12
12
  BookingHistoryOperationType["PAYMENT"] = "payment";
13
+ BookingHistoryOperationType["MERGED"] = "merged";
13
14
  })(BookingHistoryOperationType || (exports.BookingHistoryOperationType = BookingHistoryOperationType = {}));
14
15
  exports.operationTypes = [
15
16
  BookingHistoryOperationType.DELETE,
@@ -14,13 +14,23 @@ export declare class DateUtilService {
14
14
  getDateNDaysFromToday(n: number): Date;
15
15
  calculateDateDifference(fromDateCode: string, toDateCode: string, unit?: "minute" | "hr"): number;
16
16
  /**
17
- * Adds or subtracts a specified number of months from a given date in YYMMDD format.
17
+ * Adds or subtracts a specified number of months from a given date in YYMM format.
18
18
  *
19
- * @param {string} dateCode - A string representing a date in YYMMDD format.
19
+ * @param {string} dateCode - A string representing a date in YYMM format.
20
20
  * @param {number} N - An integer representing the number of months to add or subtract.
21
21
  * Use a positive value to add months and a negative value to subtract months.
22
22
  * @returns {string} A string representing the resulting date in YYMM format.
23
23
  */
24
24
  addNMonth(dateCode: string, N: number): string;
25
+ /**
26
+ * Gets an array of month codes between two specified dates (inclusive).
27
+ * Each month code is represented as a number in the format "yyMM," where "yy" is the two-digit year and "MM" is the two-digit month.
28
+ *
29
+ * @param {string} startDateCode - The starting date code in "yyMMdd" format.
30
+ * @param {string} endDateCode - The ending date code in "yyMMdd" format.
31
+ * @returns {number[]} An array of month codes representing each month between the start and end dates (inclusive).
32
+ * Each element in the array is a number in the "yyMM" format.
33
+ */
34
+ getMonthRangeByDateCodes(startDateCode: string, endDateCode: string): number[];
25
35
  }
26
36
  export declare const dateUtilService: DateUtilService;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.dateUtilService = exports.DateUtilService = void 0;
4
4
  var date_fns_1 = require("date-fns");
5
+ var _model_1 = require("../@model");
5
6
  var DateUtilService = /** @class */ (function () {
6
7
  function DateUtilService() {
7
8
  this.getDateFromDatabaseDate = function (date) { return (0, date_fns_1.parseISO)(date); };
@@ -79,9 +80,9 @@ var DateUtilService = /** @class */ (function () {
79
80
  : parseFloat((minutesDifference / 60).toFixed(1));
80
81
  };
81
82
  /**
82
- * Adds or subtracts a specified number of months from a given date in YYMMDD format.
83
+ * Adds or subtracts a specified number of months from a given date in YYMM format.
83
84
  *
84
- * @param {string} dateCode - A string representing a date in YYMMDD format.
85
+ * @param {string} dateCode - A string representing a date in YYMM format.
85
86
  * @param {number} N - An integer representing the number of months to add or subtract.
86
87
  * Use a positive value to add months and a negative value to subtract months.
87
88
  * @returns {string} A string representing the resulting date in YYMM format.
@@ -91,6 +92,20 @@ var DateUtilService = /** @class */ (function () {
91
92
  var resultDate = N >= 0 ? (0, date_fns_1.addMonths)(date, N) : (0, date_fns_1.subMonths)(date, Math.abs(N));
92
93
  return (0, date_fns_1.format)(resultDate, "yyMM");
93
94
  };
95
+ /**
96
+ * Gets an array of month codes between two specified dates (inclusive).
97
+ * Each month code is represented as a number in the format "yyMM," where "yy" is the two-digit year and "MM" is the two-digit month.
98
+ *
99
+ * @param {string} startDateCode - The starting date code in "yyMMdd" format.
100
+ * @param {string} endDateCode - The ending date code in "yyMMdd" format.
101
+ * @returns {number[]} An array of month codes representing each month between the start and end dates (inclusive).
102
+ * Each element in the array is a number in the "yyMM" format.
103
+ */
104
+ DateUtilService.prototype.getMonthRangeByDateCodes = function (startDateCode, endDateCode) {
105
+ var startDate = exports.dateUtilService.convertStringToDate(startDateCode, "yyMMdd");
106
+ var endDate = exports.dateUtilService.convertStringToDate(endDateCode, "yyMMdd");
107
+ return _model_1.BookingCode.getMonthCodesRange(startDate, endDate);
108
+ };
94
109
  return DateUtilService;
95
110
  }());
96
111
  exports.DateUtilService = DateUtilService;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "turf-common",
3
- "version": "1.2.1-beta.30",
3
+ "version": "1.2.1-beta.32",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",