Down to 71 failures.
This commit is contained in:
parent
6a2b65b75b
commit
cb6acd8c0b
|
@ -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`
|
||||
|
||||
|
|
|
@ -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
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue