UI: sorting ScheduleEntry by daySeconds (excluding date)
This commit is contained in:
parent
da31a892e1
commit
a214347757
@ -1,6 +1,10 @@
|
|||||||
import {validateBooleanNotNull, validateDateAllowNull, validateNumberNotNull, validateStringNotEmptyNotNull} from "../../validators";
|
import {validateBooleanNotNull, validateDateAllowNull, validateNumberNotNull, validateStringNotEmptyNotNull} from "../../validators";
|
||||||
import {Timestamp} from "../../Timestamp";
|
import {Timestamp} from "../../Timestamp";
|
||||||
|
|
||||||
|
function getDaySeconds(date: Date): number {
|
||||||
|
return date.getHours() * 3600 + date.getMinutes() * 60 + date.getSeconds();
|
||||||
|
}
|
||||||
|
|
||||||
export class ScheduleEntry {
|
export class ScheduleEntry {
|
||||||
|
|
||||||
private constructor(
|
private constructor(
|
||||||
@ -61,7 +65,7 @@ export class ScheduleEntry {
|
|||||||
} else if (b.nextFuzzyTimestamp === null) {
|
} else if (b.nextFuzzyTimestamp === null) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return a.nextFuzzyTimestamp.date.getTime() - b.nextFuzzyTimestamp.date.getTime();
|
return getDaySeconds(a.nextFuzzyTimestamp.date) - getDaySeconds(b.nextFuzzyTimestamp.date);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user