@lightdash/common 0.1440.1 → 0.1440.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -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;
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightdash/common",
3
- "version": "0.1440.1",
3
+ "version": "0.1440.2",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [