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

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
@@ -316,6 +316,11 @@ var BookingCode = /** @class */ (function () {
316
316
  .toString()
317
317
  .padStart(2, "0")).concat(date.getDate().toString().padStart(2, "0"));
318
318
  };
319
+ BookingCode.getMonthCode = function (date) {
320
+ return parseInt("".concat(date.getFullYear() % 2000).concat((date.getMonth() + 1)
321
+ .toString()
322
+ .padStart(2, "0")));
323
+ };
319
324
  /**
320
325
  * Returns list of month codes (YYMM) in the Date range inclusive
321
326
  * @param {Date} from - Start Date
@@ -326,14 +331,18 @@ var BookingCode = /** @class */ (function () {
326
331
  from = new Date(from.getTime());
327
332
  to = new Date(to.getTime());
328
333
  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))));
334
+ var fromMonthCode = BookingCode.getMonthCode(from);
335
+ var toMonthCode = BookingCode.getMonthCode(to);
336
+ var currentMonthCode = fromMonthCode;
337
+ while (currentMonthCode <= toMonthCode) {
338
+ monthCodes.push(currentMonthCode);
339
+ // Change of year handling
340
+ if (currentMonthCode % 100 === 12) {
341
+ currentMonthCode = currentMonthCode + 100 - 11;
342
+ }
343
+ else {
344
+ currentMonthCode = currentMonthCode + 1;
345
+ }
337
346
  }
338
347
  return monthCodes;
339
348
  };
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.47",
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
+ }