@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.
|
@@ -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
|
-
|
|
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
|