浏览代码

overview: fix filter today calc start & end (#2777)

tags/0.5.9
Eric Wang 1年前
父节点
当前提交
7001e21e7d
没有帐户链接到提交者的电子邮件
共有 1 个文件被更改,包括 11 次插入1 次删除
  1. 11
    1
      web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/chartView.tsx

+ 11
- 1
web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/chartView.tsx 查看文件

@@ -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)

正在加载...
取消
保存