@lightdash/common 0.1440.1 → 0.1440.2
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/dist/utils/scheduler.d.ts +1 -0
- package/dist/utils/scheduler.js +13 -1
- package/package.json +1 -1
@@ -3,3 +3,4 @@ export declare function formatMinutesOffset(offsetMins: number): string;
|
|
3
3
|
export declare function getTimezoneLabel(timezone: string | undefined): string | undefined;
|
4
4
|
export declare function getHumanReadableCronExpression(cronExpression: string, timezone: string): string;
|
5
5
|
export declare function isValidFrequency(cronExpression: string): boolean;
|
6
|
+
export declare function isValidTimezone(timezone: string | undefined): boolean;
|
package/dist/utils/scheduler.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.isValidFrequency = exports.getHumanReadableCronExpression = exports.getTimezoneLabel = exports.formatMinutesOffset = exports.getTzMinutesOffset = void 0;
|
3
|
+
exports.isValidTimezone = exports.isValidFrequency = exports.getHumanReadableCronExpression = exports.getTimezoneLabel = exports.formatMinutesOffset = exports.getTzMinutesOffset = void 0;
|
4
4
|
const tslib_1 = require("tslib");
|
5
5
|
const cronstrue_1 = tslib_1.__importDefault(require("cronstrue"));
|
6
6
|
function getTzMinutesOffset(oldTz, newTz) {
|
@@ -75,3 +75,15 @@ function isValidFrequency(cronExpression) {
|
|
75
75
|
return true;
|
76
76
|
}
|
77
77
|
exports.isValidFrequency = isValidFrequency;
|
78
|
+
function isValidTimezone(timezone) {
|
79
|
+
if (timezone === undefined)
|
80
|
+
return true;
|
81
|
+
try {
|
82
|
+
Intl.DateTimeFormat('en-US', { timeZone: timezone });
|
83
|
+
return true;
|
84
|
+
}
|
85
|
+
catch (e) {
|
86
|
+
return false;
|
87
|
+
}
|
88
|
+
}
|
89
|
+
exports.isValidTimezone = isValidTimezone;
|