@wandzai/utils 1.0.47-ab-pre-release-11-t-3 → 1.0.47-ab-pre-release-11-t-4
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/package.json +1 -1
- package/src/schedule.d.ts +1 -1
- package/src/schedule.js +7 -4
- package/src/schedule.js.map +1 -1
package/package.json
CHANGED
package/src/schedule.d.ts
CHANGED
|
@@ -2,5 +2,5 @@ import * as dayjs from 'dayjs';
|
|
|
2
2
|
export { dayjs };
|
|
3
3
|
export declare const nowInUTC: (asDate?: boolean) => Date | dayjs.Dayjs;
|
|
4
4
|
export declare const isInPast: (date: Date) => boolean;
|
|
5
|
-
export declare const
|
|
5
|
+
export declare const formatUTCDateWithTimezone: (date: Date, timezone: string, format: string) => string;
|
|
6
6
|
export declare const getTimezoneOffsetInHours: (region: string) => number;
|
package/src/schedule.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getTimezoneOffsetInHours = exports.
|
|
3
|
+
exports.getTimezoneOffsetInHours = exports.formatUTCDateWithTimezone = exports.isInPast = exports.nowInUTC = exports.dayjs = void 0;
|
|
4
4
|
const dayjs = require("dayjs");
|
|
5
5
|
exports.dayjs = dayjs;
|
|
6
6
|
const utc = require("dayjs/plugin/utc");
|
|
@@ -11,10 +11,13 @@ const nowInUTC = (asDate = true) => asDate ? dayjs().utc().toDate() : dayjs().ut
|
|
|
11
11
|
exports.nowInUTC = nowInUTC;
|
|
12
12
|
const isInPast = (date) => dayjs.utc(date).isBefore((0, exports.nowInUTC)());
|
|
13
13
|
exports.isInPast = isInPast;
|
|
14
|
-
const
|
|
15
|
-
return dayjs
|
|
14
|
+
const formatUTCDateWithTimezone = (date, timezone, format) => {
|
|
15
|
+
return dayjs
|
|
16
|
+
.utc(date)
|
|
17
|
+
.tz(timezone)
|
|
18
|
+
.format(format);
|
|
16
19
|
};
|
|
17
|
-
exports.
|
|
20
|
+
exports.formatUTCDateWithTimezone = formatUTCDateWithTimezone;
|
|
18
21
|
const getTimezoneOffsetInHours = (region) => {
|
|
19
22
|
const nowInTimezone = dayjs().tz(region);
|
|
20
23
|
const offsetInHours = nowInTimezone.utcOffset() / 60;
|
package/src/schedule.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schedule.js","sourceRoot":"","sources":["../../../../libs/utils/src/schedule.ts"],"names":[],"mappings":";;;AAAA,+BAA+B;AAMtB,sBAAK;AALd,wCAAwC;AACxC,kDAAkD;AAElD,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AAClB,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AAGhB,MAAM,QAAQ,GAAG,CAAC,SAAkB,IAAI,EAAsB,EAAE,CACrE,MAAM,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,GAAG,EAAE,CAAC;AADrC,QAAA,QAAQ,YAC6B;AAE3C,MAAM,QAAQ,GAAG,CAAC,IAAU,EAAW,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,IAAA,gBAAQ,GAAE,CAAC,CAAC;AAAzE,QAAA,QAAQ,YAAiE;AAE/E,MAAM,
|
|
1
|
+
{"version":3,"file":"schedule.js","sourceRoot":"","sources":["../../../../libs/utils/src/schedule.ts"],"names":[],"mappings":";;;AAAA,+BAA+B;AAMtB,sBAAK;AALd,wCAAwC;AACxC,kDAAkD;AAElD,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AAClB,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AAGhB,MAAM,QAAQ,GAAG,CAAC,SAAkB,IAAI,EAAsB,EAAE,CACrE,MAAM,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,GAAG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