@saihu/common 1.1.18 → 1.1.19

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.
@@ -3,4 +3,6 @@ export declare function getTomorrowDate(): string;
3
3
  export declare function getCurrentChinaTime(): Date;
4
4
  export declare function convertUtcToChinaTime(utcTimeString: string): string;
5
5
  export declare function convertUtcToChinaTimeFormatted(utcTimeString: string, format?: string): string;
6
+ export declare const getNextVersion: () => string;
7
+ export declare const getCurrentVersion: () => string;
6
8
  //# sourceMappingURL=times.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"times.d.ts","sourceRoot":"","sources":["../../src/util/times.ts"],"names":[],"mappings":"AAQA,wBAAgB,cAAc,WAE7B;AAED,wBAAgB,eAAe,WAE9B;AAED,wBAAgB,mBAAmB,SAMlC;AAED,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAEnE;AAED,wBAAgB,8BAA8B,CAC5C,aAAa,EAAE,MAAM,EACrB,MAAM,GAAE,MAA8B,GACrC,MAAM,CAER"}
1
+ {"version":3,"file":"times.d.ts","sourceRoot":"","sources":["../../src/util/times.ts"],"names":[],"mappings":"AAQA,wBAAgB,cAAc,WAE7B;AAED,wBAAgB,eAAe,WAE9B;AAED,wBAAgB,mBAAmB,SAMlC;AAED,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAEnE;AAED,wBAAgB,8BAA8B,CAC5C,aAAa,EAAE,MAAM,EACrB,MAAM,GAAE,MAA8B,GACrC,MAAM,CAER;AAED,eAAO,MAAM,cAAc,QAAO,MAOjC,CAAC;AACF,eAAO,MAAM,iBAAiB,QAAO,MAOpC,CAAC"}
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getCurrentVersion = exports.getNextVersion = void 0;
6
7
  exports.getCurrentDate = getCurrentDate;
7
8
  exports.getTomorrowDate = getTomorrowDate;
8
9
  exports.getCurrentChinaTime = getCurrentChinaTime;
@@ -32,3 +33,21 @@ function convertUtcToChinaTime(utcTimeString) {
32
33
  function convertUtcToChinaTimeFormatted(utcTimeString, format = 'YYYY-MM-DD HH:mm:ss') {
33
34
  return dayjs_1.default.utc(utcTimeString).tz('Asia/Shanghai').format(format);
34
35
  }
36
+ const getNextVersion = () => {
37
+ const currentUtcTime = (0, dayjs_1.default)().utc();
38
+ const cutoffTime = (0, dayjs_1.default)().utc().hour(3).minute(30).second(0);
39
+ const dateToUse = currentUtcTime.isAfter(cutoffTime)
40
+ ? currentUtcTime.add(1, 'day')
41
+ : currentUtcTime;
42
+ return dateToUse.format('YYYYMMDD');
43
+ };
44
+ exports.getNextVersion = getNextVersion;
45
+ const getCurrentVersion = () => {
46
+ const currentUtcTime = (0, dayjs_1.default)().utc();
47
+ const cutoffTime = (0, dayjs_1.default)().utc().hour(3).minute(30).second(0);
48
+ const dateToUse = currentUtcTime.isAfter(cutoffTime)
49
+ ? currentUtcTime
50
+ : currentUtcTime.subtract(1, 'day');
51
+ return dateToUse.format('YYYYMMDD');
52
+ };
53
+ exports.getCurrentVersion = getCurrentVersion;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saihu/common",
3
- "version": "1.1.18",
3
+ "version": "1.1.19",
4
4
  "description": "Common utilities for NestJS applications",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",