Skip to content
Snippets Groups Projects
Unverified Commit 65a7b1e3 authored by Ngoc Khuat's avatar Ngoc Khuat Committed by GitHub
Browse files

Rename `dateAdd` to `datetimeAdd` - the missing file (#26191)

* date-add => datetime-ad
parent a0f6a8c5
No related branches found
No related tags found
No related merge requests found
......@@ -37,8 +37,8 @@ export function infer(mbql, env) {
case "case":
return infer(mbql[1][0][1], env);
case "coalesce":
case "date-add":
case "date-subtract":
case "datetime-add":
case "datetime-subtract":
return infer(mbql[1], env);
}
......
......@@ -36,6 +36,8 @@ describe("metabase-lib/expressions/typeinferencer", () => {
case "Location":
case "Place":
return "type/Coordinate";
case "CreatedAt":
return "type/Datetime";
}
}
......@@ -112,4 +114,29 @@ describe("metabase-lib/expressions/typeinferencer", () => {
expect(type("COALESCE([BirthDate], [MiscDate])")).toEqual("type/Temporal");
expect(type("COALESCE([Place], [Location])")).toEqual("type/Coordinate");
});
it("should infer the result of datetimeAdd, datetimeSubtract", () => {
expect(type('datetimeAdd([CreatedAt], 2, "month")')).toEqual(
"type/Datetime",
);
expect(type('datetimeSubtract([CreatedAt], 2, "month")')).toEqual(
"type/Datetime",
);
});
it("should infer the result of datetimeExtract functions", () => {
const ops = [
"year",
"month",
"quarter",
"month",
"week",
"hour",
"minute",
"second",
];
ops.forEach(op => {
expect(type(`${op}([Created At])`)).toEqual("number");
});
});
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment