Skip to content

Commit af9247b

Browse files
committed
special case for unquoted dates in values
1 parent c39162a commit af9247b

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
@@ -155,6 +155,10 @@ export class YamlCompiler {
155155
ast = t.booleanLiteral(code);
156156
} else if (typeof code === 'number') {
157157
ast = t.numericLiteral(code);
158+
} else if (code instanceof Date) {
159+
// Special case when dates are defined in YAML as strings without quotes
160+
// YAML parser treats them as Date objects, but for conversion we need them as strings
161+
ast = this.parsePythonAndTranspileToJs(`f"${this.escapeDoubleQuotes(code.toISOString())}"`, errorsReport);
158162
}
159163
}
160164
if (ast === null) {

0 commit comments

Comments
 (0)