1
0
Fork 0
mirror of synced 2024-10-05 20:44:47 +13:00

Down to 71 failures.

This commit is contained in:
Sam Rose 2024-06-13 12:24:27 +01:00
parent 6a2b65b75b
commit cb6acd8c0b
No known key found for this signature in database
2 changed files with 22 additions and 11 deletions

View file

@ -1079,13 +1079,13 @@ describe.each([
!isInternal &&
describe("datetime - time only", () => {
const T_1000 = "10:00"
const T_1045 = "10:45"
const T_1200 = "12:00"
const T_1530 = "15:30"
const T_0000 = "00:00"
const T_1000 = "10:00:00"
const T_1045 = "10:45:00"
const T_1200 = "12:00:00"
const T_1530 = "15:30:00"
const T_0000 = "00:00:00"
const UNEXISTING_TIME = "10:01"
const UNEXISTING_TIME = "10:01:00"
const NULL_TIME__ID = `null_time__id`

View file

@ -519,18 +519,29 @@ export const sort = (
if (!sort || !sortOrder || !sortType) {
return docs
}
const parse =
sortType === "string" ? (x: any) => `${x}` : (x: string) => parseFloat(x)
const parse = (x: any) => {
if (x == null) {
return x
}
if (sortType === "string") {
return `${x}`
}
return parseFloat(x)
}
return docs
.slice()
.sort((a: { [x: string]: any }, b: { [x: string]: any }) => {
const colA = parse(a[sort])
const colB = parse(b[sort])
const result = colB == null || colA > colB ? 1 : -1
if (sortOrder.toLowerCase() === "descending") {
return colA > colB ? -1 : 1
} else {
return colA > colB ? 1 : -1
return result * -1
}
return result
})
}