Skip to content

Commit 08504a8

Browse files
committed
fix: update date handling in user usage components
1 parent c70c1ac commit 08504a8

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/widgets/dashboard/nodes/node-users-usage-drawer/node-users-usage-drawer.widget.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,15 @@ export const NodeUsersUsageDrawer = (props: IProps) => {
8787
setViewType('stacked')
8888
setPeriod('7')
8989
setDateRange([
90-
dayjs().utc().subtract(7, 'day').startOf('hour').toDate(),
91-
dayjs().utc().startOf('hour').toDate()
90+
dayjs().utc().subtract(7, 'day').startOf('day').toDate(),
91+
dayjs().utc().endOf('day').toDate()
9292
])
9393
}
9494
}, [opened])
9595

9696
useEffect(() => {
97-
const end = dayjs().utc().startOf('hour').toDate()
98-
const start = dayjs().utc().subtract(Number(period), 'day').startOf('hour').toDate()
97+
const end = dayjs().utc().endOf('day').toDate()
98+
const start = dayjs().utc().subtract(Number(period), 'day').startOf('day').toDate()
9999
setDateRange([start, end])
100100
}, [period])
101101

src/widgets/dashboard/users/user-usage-modal/user-usage-modal.widget.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ export const UserUsageModalWidget = (props: IProps) => {
4545

4646
const [period, setPeriod] = useState<'7' | '14' | '30' | '60' | '90' | '180' | '365'>('7')
4747
const [dateRange, setDateRange] = useState<[Date, Date]>([
48-
dayjs().utc().subtract(7, 'day').startOf('hour').toDate(),
49-
dayjs().utc().startOf('hour').toDate()
48+
dayjs().utc().subtract(7, 'day').startOf('day').toDate(),
49+
dayjs().utc().endOf('day').toDate()
5050
])
5151
const [selectedNodes, setSelectedNodes] = useState<string[]>([])
5252
const [viewType, setViewType] = useState<'grouped' | 'stacked'>('stacked')
@@ -68,15 +68,15 @@ export const UserUsageModalWidget = (props: IProps) => {
6868
setViewType('stacked')
6969
setPeriod('7')
7070
setDateRange([
71-
dayjs().utc().subtract(7, 'day').startOf('hour').toDate(),
72-
dayjs().utc().startOf('hour').toDate()
71+
dayjs().utc().subtract(7, 'day').startOf('day').toDate(),
72+
dayjs().utc().endOf('day').toDate()
7373
])
7474
}
7575
}, [opened])
7676

7777
useEffect(() => {
78-
const end = dayjs().utc().startOf('hour').toDate()
79-
const start = dayjs().utc().subtract(Number(period), 'day').startOf('hour').toDate()
78+
const end = dayjs().utc().endOf('day').toDate()
79+
const start = dayjs().utc().subtract(Number(period), 'day').startOf('day').toDate()
8080
setDateRange([start, end])
8181
}, [period])
8282

0 commit comments

Comments
 (0)