Skip to content

Commit 8dc8f33

Browse files
committed
special case for unquoted dates in values
1 parent 0df7f13 commit 8dc8f33

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

packages/cubejs-schema-compiler/src/compiler/YamlCompiler.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,10 @@ export class YamlCompiler {
167167
ast = t.booleanLiteral(code);
168168
} else if (typeof code === 'number') {
169169
ast = t.numericLiteral(code);
170+
} else if (code instanceof Date) {
171+
// Special case when dates are defined in YAML as strings without quotes
172+
// YAML parser treats them as Date objects, but for conversion we need them as strings
173+
ast = this.parsePythonAndTranspileToJs(`f"${this.escapeDoubleQuotes(code.toISOString())}"`, errorsReport);
170174
}
171175
}
172176
if (ast === null) {

0 commit comments

Comments
 (0)