Skip to content

Commit 316845a

Browse files
committed
change the time periods
1 parent c8fffc8 commit 316845a

File tree

1 file changed

+13
-25
lines changed

1 file changed

+13
-25
lines changed

ui/src/hooks/useGetRangeDatesAndGranularity.tsx

Lines changed: 13 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,15 @@ const useGetRangeDatesAndGranularity = (
5050
options.push(Period.Weekly);
5151
break;
5252
case 3: // day
53-
if (end.diff(start, 'd', true) >= 1 && end.diff(start, 'M', true) <= 2)
53+
if (end.diff(start, 'd', true) >= 1 && end.diff(start, 'M', true) <= 3) // Changed from 2 to 3 months
5454
options.push(Period.Daily);
5555
break;
5656
case 4: // hour
57-
if (end.diff(start, 'h', true) >= 1 && end.diff(start, 'h', true) <= 60)
57+
if (end.diff(start, 'h', true) >= 1 && end.diff(start, 'h', true) <= 120)
5858
options.push(Period.Hourly);
5959
break;
6060
case 5: // minutes
61-
if (end.diff(start, 'h', true) <= 5) options.push(Period.Minutely);
61+
if (end.diff(start, 'h', true) <= 12) options.push(Period.Minutely);
6262
break;
6363
default:
6464
break;
@@ -114,44 +114,32 @@ const useGetRangeDatesAndGranularity = (
114114
allowClear={false}
115115
allowEmpty={false}
116116
presets={[
117-
{
118-
label: 'Last 30 minutes',
119-
value: [dayjs().add(-0.5, 'h'), dayjs()]
120-
},
121-
{
122-
label: 'Last hour',
123-
value: [dayjs().add(-1, 'h'), dayjs()]
124-
},
125-
{
126-
label: 'Last 6 hours',
127-
value: [dayjs().add(-6, 'h'), dayjs()]
128-
},
129117
{
130118
label: 'Last 12 hours',
131-
value: [dayjs().add(-12, 'h'), dayjs()]
119+
value: [dayjs().subtract(12, 'hour'), dayjs()]
132120
},
133121
{
134-
label: 'Today',
135-
value: [dayjs().startOf('day'), dayjs()]
122+
label: 'Last 24 hours',
123+
value: [dayjs().subtract(24, 'hour'), dayjs()]
136124
},
137125
{
138126
label: 'Yesterday',
139127
value: [
140-
dayjs().add(-1, 'd').startOf('day'),
141-
dayjs().add(0, 'd').startOf('day')
128+
dayjs().subtract(1, 'day').startOf('day'),
129+
dayjs().subtract(1, 'day').endOf('day')
142130
]
143131
},
144132
{
145133
label: 'Last 7 Days',
146-
value: [dayjs().add(-7, 'd').startOf('day'), dayjs()]
134+
value: [dayjs().subtract(7, 'day').startOf('day'), dayjs()]
147135
},
148136
{
149-
label: 'Last 14 Days',
150-
value: [dayjs().add(-14, 'd').startOf('day'), dayjs()]
137+
label: 'Last 30 Days',
138+
value: [dayjs().subtract(30, 'day').startOf('day'), dayjs()]
151139
},
152140
{
153-
label: 'Last 30 Days',
154-
value: [dayjs().add(-30, 'd').startOf('day'), dayjs()]
141+
label: 'Last 3 Months',
142+
value: [dayjs().subtract(3, 'month').startOf('day'), dayjs()]
155143
}
156144
]}
157145
/>

0 commit comments

Comments
 (0)