Solve _some_ date problems.

This commit is contained in:
Sam Rose 2024-07-30 16:03:03 +01:00
parent d06377a25d
commit c6ec710abe
No known key found for this signature in database
3 changed files with 15 additions and 13 deletions

View File

@ -237,7 +237,7 @@ class InternalBuilder {
return `${hours}:${minutes}:${seconds}` return `${hours}:${minutes}:${seconds}`
} }
if (typeof input === "string") { if (typeof input === "string") {
return new Date(`1970-01-01 ${input}`) return new Date(`1970-01-01T${input}Z`)
} }
} }

View File

@ -40,14 +40,14 @@ import { structures } from "@budibase/backend-core/tests"
import { DEFAULT_EMPLOYEE_TABLE_SCHEMA } from "../../../db/defaultData/datasource_bb_default" import { DEFAULT_EMPLOYEE_TABLE_SCHEMA } from "../../../db/defaultData/datasource_bb_default"
describe.each([ describe.each([
["in-memory", undefined], // ["in-memory", undefined],
["lucene", undefined], // ["lucene", undefined],
["sqs", undefined], // ["sqs", undefined],
[DatabaseName.POSTGRES, getDatasource(DatabaseName.POSTGRES)], // [DatabaseName.POSTGRES, getDatasource(DatabaseName.POSTGRES)],
[DatabaseName.MYSQL, getDatasource(DatabaseName.MYSQL)], // [DatabaseName.MYSQL, getDatasource(DatabaseName.MYSQL)],
[DatabaseName.SQL_SERVER, getDatasource(DatabaseName.SQL_SERVER)], // [DatabaseName.SQL_SERVER, getDatasource(DatabaseName.SQL_SERVER)],
[DatabaseName.MARIADB, getDatasource(DatabaseName.MARIADB)], // [DatabaseName.MARIADB, getDatasource(DatabaseName.MARIADB)],
// [DatabaseName.ORACLE, getDatasource(DatabaseName.ORACLE)], [DatabaseName.ORACLE, getDatasource(DatabaseName.ORACLE)],
])("search (%s)", (name, dsProvider) => { ])("search (%s)", (name, dsProvider) => {
const isSqs = name === "sqs" const isSqs = name === "sqs"
const isLucene = name === "lucene" const isLucene = name === "lucene"
@ -2389,9 +2389,9 @@ describe.each([
describe.each([ describe.each([
{ low: "2024-07-03T00:00:00.000Z", high: "9999-00-00T00:00:00.000Z" }, { low: "2024-07-03T00:00:00.000Z", high: "9999-00-00T00:00:00.000Z" },
// { low: "2024-07-03T00:00:00.000Z", high: "9998-00-00T00:00:00.000Z" }, { low: "2024-07-03T00:00:00.000Z", high: "9998-00-00T00:00:00.000Z" },
// { low: "0000-00-00T00:00:00.000Z", high: "2024-07-04T00:00:00.000Z" }, { low: "0000-00-00T00:00:00.000Z", high: "2024-07-04T00:00:00.000Z" },
// { low: "0001-00-00T00:00:00.000Z", high: "2024-07-04T00:00:00.000Z" }, { low: "0001-00-00T00:00:00.000Z", high: "2024-07-04T00:00:00.000Z" },
])("date special cases", ({ low, high }) => { ])("date special cases", ({ low, high }) => {
const earlyDate = "2024-07-03T10:00:00.000Z", const earlyDate = "2024-07-03T10:00:00.000Z",
laterDate = "2024-07-03T11:00:00.000Z" laterDate = "2024-07-03T11:00:00.000Z"

View File

@ -406,7 +406,9 @@ class OracleIntegration extends Sql implements DatasourcePlus {
password: this.config.password, password: this.config.password,
connectString, connectString,
} }
return oracledb.getConnection(attributes) const connection = await oracledb.getConnection(attributes)
await connection.execute(`ALTER SESSION SET TIME_ZONE='UTC'`)
return connection
} }
async create(query: SqlQuery | string): Promise<any[]> { async create(query: SqlQuery | string): Promise<any[]> {