Skip to content

Commit

Permalink
fix(OH2-439): Fix dashboard filter date range (#702)
Browse files Browse the repository at this point in the history
Co-authored-by: SteveGT96 <[email protected]>
  • Loading branch information
SteveGT96 and SteveGT96 authored Nov 28, 2024
1 parent ecb5f25 commit abec44a
Showing 1 changed file with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,39 +22,39 @@ export const usePeriodOptions = () => {
if (view !== "range") {
switch (selection) {
case "current":
value = [moment().utc().startOf(view), moment().utc().endOf(view)];
value = [moment().startOf(view), moment().endOf(view)];
break;
case "previous":
value = [
moment().add(-1, view).utc().startOf(view),
moment().add(-1, view).utc().endOf(view),
moment().add(-1, view).startOf(view),
moment().add(-1, view).endOf(view),
];
break;
case "last2":
value = [
moment().add(-2, view).utc().startOf(view),
moment().add(-1, view).utc().endOf(view),
moment().add(-2, view).startOf(view),
moment().add(-1, view).endOf(view),
];
break;
case "last3":
value = [
moment().add(-3, view).utc().startOf(view),
moment().add(-1, view).utc().endOf(view),
moment().add(-3, view).startOf(view),
moment().add(-1, view).endOf(view),
];
break;
default:
value = [
moment(dateRange[0]?.toISOString()).utc().startOf("day"),
moment(dateRange[1]?.toISOString()).utc().endOf("day"),
moment(dateRange[0]?.toISOString()).startOf("day"),
moment(dateRange[1]?.toISOString()).endOf("day"),
];
}
if (view === "week") {
value = [value[0].add(1, "day"), value[1].add(1, "day")];
}
} else {
value = [
moment(dateRange[0]?.toISOString()).utc().startOf("day"),
moment(dateRange[1]?.toISOString()).utc().endOf("day"),
moment(dateRange[0]?.toISOString()).startOf("day"),
moment(dateRange[1]?.toISOString()).endOf("day"),
];
}
return [value[0].toISOString(), value[1].toISOString()];
Expand Down

0 comments on commit abec44a

Please sign in to comment.