Commit c9651bd8bf9e5f098e4c9f125470608ccb06a877
Merge branch 'perf/application-call' into 'main_dev'
fix: 统一统计时间间隔计算 See merge request yunteng/thingskit-front!1503
Showing
1 changed file
with
4 additions
and
1 deletions
... | ... | @@ -55,7 +55,7 @@ export const formSchema: DescItem[] = [ |
55 | 55 | function generateFullXAxis(type: DateInterval) { |
56 | 56 | if (type === 'hour') { |
57 | 57 | let minute = dateUtil().minute(); |
58 | - minute = minute - (minute % 10); | |
58 | + minute = Math.floor(minute / 5) * 5; | |
59 | 59 | |
60 | 60 | return Array.from({ length: 60 / 5 }, (_, index) => |
61 | 61 | dateUtil() |
... | ... | @@ -65,8 +65,11 @@ function generateFullXAxis(type: DateInterval) { |
65 | 65 | .valueOf() |
66 | 66 | ); |
67 | 67 | } else if (type === 'day') { |
68 | + let hour = dateUtil().hour(); | |
69 | + hour = Math.floor(hour / 2) * 2; | |
68 | 70 | return Array.from({ length: 24 / 2 }, (_, index) => |
69 | 71 | dateUtil() |
72 | + .hour(hour) | |
70 | 73 | .subtract(index * 2, 'hour') |
71 | 74 | .startOf('hour') |
72 | 75 | .valueOf() | ... | ... |