@saihu/common 1.1.15 → 1.1.17

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.
@@ -1,5 +1,6 @@
1
1
  export declare function getCurrentDate(): string;
2
2
  export declare function getTomorrowDate(): string;
3
+ export declare function getCurrentChinaTime(): Date;
3
4
  export declare function convertUtcToChinaTime(utcTimeString: string): string;
4
5
  export declare function convertUtcToChinaTimeFormatted(utcTimeString: string, format?: string): string;
5
6
  //# 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,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"}
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getCurrentDate = getCurrentDate;
7
7
  exports.getTomorrowDate = getTomorrowDate;
8
+ exports.getCurrentChinaTime = getCurrentChinaTime;
8
9
  exports.convertUtcToChinaTime = convertUtcToChinaTime;
9
10
  exports.convertUtcToChinaTimeFormatted = convertUtcToChinaTimeFormatted;
10
11
  const dayjs_1 = __importDefault(require("dayjs"));
@@ -19,6 +20,12 @@ function getCurrentDate() {
19
20
  function getTomorrowDate() {
20
21
  return (0, dayjs_1.default)().add(1, 'day').format('YYYY-MM-DD');
21
22
  }
23
+ function getCurrentChinaTime() {
24
+ const chinaTime = (0, dayjs_1.default)().tz('Asia/Shanghai');
25
+ const chinaDateString = chinaTime.format('YYYY-MM-DD HH:mm:ss.SSS');
26
+ const chinaDate = new Date(chinaDateString + 'Z');
27
+ return chinaDate;
28
+ }
22
29
  function convertUtcToChinaTime(utcTimeString) {
23
30
  return dayjs_1.default.utc(utcTimeString).tz('Asia/Shanghai').format();
24
31
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saihu/common",
3
- "version": "1.1.15",
3
+ "version": "1.1.17",
4
4
  "description": "Common utilities for NestJS applications",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",