mirror of
https://github.com/langgenius/dify.git
synced 2024-11-16 11:42:29 +08:00
overview: fix filter today calc start & end (#2777)
This commit is contained in:
parent
82d0732c12
commit
7001e21e7d
|
@ -29,7 +29,17 @@ export default function ChartView({ appId }: IChartViewProps) {
|
|||
const [period, setPeriod] = useState<PeriodParams>({ name: t('appLog.filter.period.last7days'), query: { start: today.subtract(7, 'day').format(queryDateFormat), end: today.format(queryDateFormat) } })
|
||||
|
||||
const onSelect = (item: Item) => {
|
||||
setPeriod({ name: item.name, query: item.value === 'all' ? undefined : { start: today.subtract(item.value as number, 'day').format(queryDateFormat), end: today.format(queryDateFormat) } })
|
||||
if (item.value === 'all') {
|
||||
setPeriod({ name: item.name, query: undefined })
|
||||
}
|
||||
else if (item.value === 0) {
|
||||
const startOfToday = today.startOf('day').format(queryDateFormat)
|
||||
const endOfToday = today.endOf('day').format(queryDateFormat)
|
||||
setPeriod({ name: item.name, query: { start: startOfToday, end: endOfToday } })
|
||||
}
|
||||
else {
|
||||
setPeriod({ name: item.name, query: { start: today.subtract(item.value as number, 'day').format(queryDateFormat), end: today.format(queryDateFormat) } })
|
||||
}
|
||||
}
|
||||
|
||||
if (!response)
|
||||
|
|
Loading…
Reference in New Issue
Block a user