@malloydata/malloy 0.0.38-dev230609221655 → 0.0.38-dev230612181657

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.
@@ -3,4 +3,5 @@ export declare class TimezoneStatement extends MalloyElement {
3
3
  readonly tz: string;
4
4
  elementType: string;
5
5
  constructor(tz: string);
6
+ get isValid(): boolean;
6
7
  }
@@ -30,6 +30,15 @@ class TimezoneStatement extends malloy_element_1.MalloyElement {
30
30
  this.tz = tz;
31
31
  this.elementType = 'timezone';
32
32
  }
33
+ get isValid() {
34
+ try {
35
+ Intl.DateTimeFormat(undefined, { timeZone: this.tz });
36
+ return true;
37
+ }
38
+ catch {
39
+ return false;
40
+ }
41
+ }
33
42
  }
34
43
  exports.TimezoneStatement = TimezoneStatement;
35
44
  //# sourceMappingURL=timezone-statement.js.map
@@ -472,7 +472,11 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
472
472
  return this.visitTimezoneStatement(cx.timezoneStatement());
473
473
  }
474
474
  visitTimezoneStatement(cx) {
475
- return this.astAt(new ast.TimezoneStatement(this.stripQuotes(cx.STRING_LITERAL().text)), cx);
475
+ const timezoneStatement = new ast.TimezoneStatement(this.stripQuotes(cx.STRING_LITERAL().text));
476
+ if (!timezoneStatement.isValid) {
477
+ this.astError(timezoneStatement, `Invalid timezone: ${timezoneStatement.tz}`);
478
+ }
479
+ return this.astAt(timezoneStatement, cx);
476
480
  }
477
481
  visitQueryProperties(pcx) {
478
482
  const qProps = pcx
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@malloydata/malloy",
3
- "version": "0.0.38-dev230609221655",
3
+ "version": "0.0.38-dev230612181657",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",