@saihu/common 1.1.26 → 1.1.27

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,3 +1,5 @@
1
+ export declare function getDayStart(date: string): Date;
2
+ export declare function getDayEnd(date: string): Date;
1
3
  export declare function getCurrentDate(): string;
2
4
  export declare function getTomorrowDate(): string;
3
5
  export declare function getCurrentChinaTime(): Date;
@@ -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;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CASjD;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAS/C;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE7D;AACD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE3D;AAED,eAAO,MAAM,cAAc,QAAO,MAOjC,CAAC;AACF,eAAO,MAAM,iBAAiB,QAAO,MAOpC,CAAC"}
1
+ {"version":3,"file":"times.d.ts","sourceRoot":"","sources":["../../src/util/times.ts"],"names":[],"mappings":"AAQA,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,QAEvC;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,QAErC;AAED,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,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CASjD;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAS/C;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE7D;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE3D;AAED,eAAO,MAAM,cAAc,QAAO,MAOjC,CAAC;AAEF,eAAO,MAAM,iBAAiB,QAAO,MAOpC,CAAC"}
@@ -4,6 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getCurrentVersion = exports.getNextVersion = void 0;
7
+ exports.getDayStart = getDayStart;
8
+ exports.getDayEnd = getDayEnd;
7
9
  exports.getCurrentDate = getCurrentDate;
8
10
  exports.getTomorrowDate = getTomorrowDate;
9
11
  exports.getCurrentChinaTime = getCurrentChinaTime;
@@ -19,6 +21,12 @@ const timezone_1 = __importDefault(require("dayjs/plugin/timezone"));
19
21
  // Enable timezone support
20
22
  dayjs_1.default.extend(utc_1.default);
21
23
  dayjs_1.default.extend(timezone_1.default);
24
+ function getDayStart(date) {
25
+ return dayjs_1.default.utc(date).startOf('day').toDate();
26
+ }
27
+ function getDayEnd(date) {
28
+ return dayjs_1.default.utc(date).endOf('day').toDate();
29
+ }
22
30
  function getCurrentDate() {
23
31
  return (0, dayjs_1.default)().tz('Asia/Shanghai').format('YYYY-MM-DD');
24
32
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saihu/common",
3
- "version": "1.1.26",
3
+ "version": "1.1.27",
4
4
  "description": "Common utilities for NestJS applications",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",