fix(X-Pack): 阈值告警-设置的时间控件与图表时间格式不一致

This commit is contained in:
fit2cloud-chenyw 2024-11-05 16:57:12 +08:00
parent 065a430c7e
commit 686bdd038c
2 changed files with 6 additions and 4 deletions

View File

@ -362,9 +362,9 @@ public class ChartViewThresholdManage {
}
} else {
if (timeFlag == 4) {
return now.withDayOfMonth(1).format(formatter);
return now.withDayOfMonth(1).withHour(0).withMinute(0).withSecond(0).format(formatter);
} else if (timeFlag == 5) {
return now.plusMonths(1).withDayOfMonth(1).minusDays(1).format(formatter);
return now.plusMonths(1).withDayOfMonth(1).minusDays(1).withHour(0).withMinute(0).withSecond(0).format(formatter);
} else {
return getCustomTimeValue(format, 3, suffix, count, true);
}
@ -381,7 +381,9 @@ public class ChartViewThresholdManage {
LocalDateTime now = LocalDateTime.now();
String fullFormat = "yyyy-MM-dd HH:mm:ss";
int len = format.length();
if (!hasTime) {
if (hasTime) {
now = now.withHour(0).withMinute(0).withSecond(0);
} else {
len = Math.min(len, 10);
}
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(fullFormat.substring(0, len));

@ -1 +1 @@
Subproject commit 15fd94f9b316a6956be8eddaf4ba6196dcccb7a2
Subproject commit 7d763d1a73750889a5a6abc6faf658aab3c48099