1
0
Fork 0
mirror of synced 2024-09-20 19:33:10 +12:00

Fix dates and times for good? maybe?

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

View file

@ -666,19 +666,16 @@ class InternalBuilder {
let nulls: "first" | "last" | undefined = undefined let nulls: "first" | "last" | undefined = undefined
if ( if (
this.client === SqlClient.ORACLE || this.client === SqlClient.POSTGRES ||
this.client === SqlClient.POSTGRES this.client === SqlClient.ORACLE
) { ) {
nulls = value.direction === SortOrder.ASCENDING ? "first" : "last" nulls = value.direction === SortOrder.ASCENDING ? "first" : "last"
} }
let composite = `${aliased}.${key}` let composite = `${aliased}.${key}`
if (this.client === SqlClient.ORACLE) { if (this.client === SqlClient.ORACLE) {
query = query.orderBy( query = query.orderByRaw(
// @ts-ignore `${this.convertClobs(composite)} ${direction} nulls ${nulls}`
this.knex.raw(this.convertClobs(composite)),
direction,
nulls
) )
} else { } else {
query = query.orderBy(composite, direction, nulls) query = query.orderBy(composite, direction, nulls)

View file

@ -406,9 +406,7 @@ class OracleIntegration extends Sql implements DatasourcePlus {
password: this.config.password, password: this.config.password,
connectString, connectString,
} }
const connection = await oracledb.getConnection(attributes) return 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[]> {

View file

@ -318,9 +318,15 @@ export async function outputProcessing<T extends Row[] | Row>(
} else if (column.type === FieldType.DATETIME && column.timeOnly) { } else if (column.type === FieldType.DATETIME && column.timeOnly) {
for (let row of enriched) { for (let row of enriched) {
if (row[property] instanceof Date) { if (row[property] instanceof Date) {
const hours = row[property].getHours().toString().padStart(2, "0") const hours = row[property].getUTCHours().toString().padStart(2, "0")
const minutes = row[property].getMinutes().toString().padStart(2, "0") const minutes = row[property]
const seconds = row[property].getSeconds().toString().padStart(2, "0") .getUTCMinutes()
.toString()
.padStart(2, "0")
const seconds = row[property]
.getUTCSeconds()
.toString()
.padStart(2, "0")
row[property] = `${hours}:${minutes}:${seconds}` row[property] = `${hours}:${minutes}:${seconds}`
} }
} }