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

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.
package/README.md CHANGED
@@ -1,20 +1,20 @@
1
- ## 1 npm init -y
2
-
3
- ## 2 npm login
4
-
5
- ## 3 npm version patch
6
-
7
- # //it increase version
8
-
9
- ## 3 npm publish --access public
10
-
11
- # //npm publish by default --access public
12
-
13
- ## 4 npm run version:deploy
14
-
15
- ### deploy version
16
-
17
- ## Client side
18
-
19
- update package command <br />
20
- npm update turf-comman
1
+ ## 1 npm init -y
2
+
3
+ ## 2 npm login
4
+
5
+ ## 3 npm version patch
6
+
7
+ # //it increase version
8
+
9
+ ## 3 npm publish --access public
10
+
11
+ # //npm publish by default --access public
12
+
13
+ ## 4 npm run version:deploy
14
+
15
+ ### deploy version
16
+
17
+ ## Client side
18
+
19
+ update package command <br />
20
+ npm update turf-comman
@@ -55,6 +55,7 @@ export declare class BookingCode {
55
55
  static isValidTimeRange(timeSlot: string): boolean;
56
56
  static dateFormat(dates: Array<Date>): Array<string>;
57
57
  static getDateCode(date: Date): string;
58
+ static getMonthCode(date: Date): number;
58
59
  /**
59
60
  * Returns list of month codes (YYMM) in the Date range inclusive
60
61
  * @param {Date} from - Start Date
@@ -111,7 +111,12 @@ var BookingCode = /** @class */ (function () {
111
111
  };
112
112
  BookingCode.prototype.isModificationAllowed = function (delayInMinutes) {
113
113
  if (delayInMinutes === void 0) { delayInMinutes = _utils_1.DEFAULT_BOOKING_MODIFICATION_DELAY_IN_MINUTES; }
114
- var bookingToDateTimeWithDelay = date_util_1.dateUtilService.addMinutesTo(date_util_1.dateUtilService.convertStringToDate(this.getDateWithToTimeCode(), "yyMMddHHmm"), delayInMinutes);
114
+ var dateWithToTimeCode = this.getDateWithToTimeCode();
115
+ // If last four digits of dateWithToTimeCode is 2400, then replace it with 2359
116
+ if (dateWithToTimeCode.slice(-4) === _utils_1.END_OF_DAY_TIME_CODE) {
117
+ dateWithToTimeCode = dateWithToTimeCode.slice(0, -4) + "2359";
118
+ }
119
+ var bookingToDateTimeWithDelay = date_util_1.dateUtilService.addMinutesTo(date_util_1.dateUtilService.convertStringToDate(dateWithToTimeCode, "yyMMddHHmm"), delayInMinutes);
115
120
  var currentTime = date_util_1.dateUtilService.getIndianDate();
116
121
  return bookingToDateTimeWithDelay > currentTime;
117
122
  };
@@ -316,6 +321,11 @@ var BookingCode = /** @class */ (function () {
316
321
  .toString()
317
322
  .padStart(2, "0")).concat(date.getDate().toString().padStart(2, "0"));
318
323
  };
324
+ BookingCode.getMonthCode = function (date) {
325
+ return parseInt("".concat(date.getFullYear() % 2000).concat((date.getMonth() + 1)
326
+ .toString()
327
+ .padStart(2, "0")));
328
+ };
319
329
  /**
320
330
  * Returns list of month codes (YYMM) in the Date range inclusive
321
331
  * @param {Date} from - Start Date
@@ -326,14 +336,18 @@ var BookingCode = /** @class */ (function () {
326
336
  from = new Date(from.getTime());
327
337
  to = new Date(to.getTime());
328
338
  var monthCodes = [];
329
- while (from < to) {
330
- var fromDateCode = BookingCode.getDateCode(from);
331
- monthCodes.push(parseInt("".concat(fromDateCode.slice(0, 4))));
332
- from.setMonth(from.getMonth() + 1);
333
- }
334
- var toDateCode = BookingCode.getDateCode(to);
335
- if (!monthCodes.includes(parseInt("".concat(toDateCode.slice(0, 4))))) {
336
- monthCodes.push(parseInt("".concat(toDateCode.slice(0, 4))));
339
+ var fromMonthCode = BookingCode.getMonthCode(from);
340
+ var toMonthCode = BookingCode.getMonthCode(to);
341
+ var currentMonthCode = fromMonthCode;
342
+ while (currentMonthCode <= toMonthCode) {
343
+ monthCodes.push(currentMonthCode);
344
+ // Change of year handling
345
+ if (currentMonthCode % 100 === 12) {
346
+ currentMonthCode = currentMonthCode + 100 - 11;
347
+ }
348
+ else {
349
+ currentMonthCode = currentMonthCode + 1;
350
+ }
337
351
  }
338
352
  return monthCodes;
339
353
  };
package/package.json CHANGED
@@ -1,43 +1,43 @@
1
- {
2
- "name": "turf-common",
3
- "version": "1.4.2-beta.46",
4
- "description": "",
5
- "main": "./build/index.js",
6
- "types": "./build/index.d.ts",
7
- "files": [
8
- "build/**/*"
9
- ],
10
- "scripts": {
11
- "clean": "rm -rf build",
12
- "build": "npm run clean && tsc",
13
- "version:deploy:beta": "npm version prerelease --preid beta && git push && npm run build && npm publish --tag beta",
14
- "version:deploy:patch": "npm version patch && git push && npm run build && npm publish",
15
- "version:deploy:minor": "npm version minor && git push && npm run build && npm publish",
16
- "test": "jest",
17
- "test:pattern": "jest -i unit/charges/discount-relative",
18
- "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" 2>&1| tee eslint.log",
19
- "lint:fix": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix"
20
- },
21
- "repository": {
22
- "type": "git",
23
- "url": "github__bellex-dev__turf-common:bellex-dev/turf-common.git"
24
- },
25
- "keywords": [],
26
- "author": "",
27
- "license": "ISC",
28
- "devDependencies": {
29
- "@types/jest": "^29.5.11",
30
- "@types/node": "^20.8.9",
31
- "@typescript-eslint/eslint-plugin": "^6.7.2",
32
- "@typescript-eslint/parser": "^6.7.2",
33
- "del-cli": "^5.1.0",
34
- "eslint": "^8.50.0",
35
- "jest": "^29.7.0",
36
- "ts-jest": "^29.1.1",
37
- "ts-node": "^10.9.2",
38
- "typescript": "^5.2.2"
39
- },
40
- "dependencies": {
41
- "date-fns": "^2.30.0"
42
- }
43
- }
1
+ {
2
+ "name": "turf-common",
3
+ "version": "1.4.2-beta.48",
4
+ "description": "",
5
+ "main": "./build/index.js",
6
+ "types": "./build/index.d.ts",
7
+ "files": [
8
+ "build/**/*"
9
+ ],
10
+ "scripts": {
11
+ "clean": "rm -rf build",
12
+ "build": "npm run clean && tsc",
13
+ "version:deploy:beta": "npm version prerelease --preid beta && git push && npm run build && npm publish --tag beta",
14
+ "version:deploy:patch": "npm version patch && git push && npm run build && npm publish",
15
+ "version:deploy:minor": "npm version minor && git push && npm run build && npm publish",
16
+ "test": "jest",
17
+ "test:pattern": "jest -i unit/charges/discount-relative",
18
+ "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" 2>&1| tee eslint.log",
19
+ "lint:fix": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix"
20
+ },
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "github__bellex-dev__turf-common:bellex-dev/turf-common.git"
24
+ },
25
+ "keywords": [],
26
+ "author": "",
27
+ "license": "ISC",
28
+ "devDependencies": {
29
+ "@types/jest": "^29.5.11",
30
+ "@types/node": "^20.8.9",
31
+ "@typescript-eslint/eslint-plugin": "^6.7.2",
32
+ "@typescript-eslint/parser": "^6.7.2",
33
+ "del-cli": "^5.1.0",
34
+ "eslint": "^8.50.0",
35
+ "jest": "^29.7.0",
36
+ "ts-jest": "^29.1.1",
37
+ "ts-node": "^10.9.2",
38
+ "typescript": "^5.2.2"
39
+ },
40
+ "dependencies": {
41
+ "date-fns": "^2.30.0"
42
+ }
43
+ }