From 2ca16c2e30c15a4a6e56b880b23448c2f8518c19 Mon Sep 17 00:00:00 2001 From: zhaofangxun Date: Mon, 11 May 2026 11:26:53 +0800 Subject: [PATCH] fix: correct relative time format for yesterday MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Use UDAT_ABSOLUTE_DAY instead of UDAT_DIRECTION_LAST + UDAT_RELATIVE_DAYS 2. Remove the redundant numeric argument that was passed to formatter->format() 3. Ensure the ICU API call matches the correct overload for absolute day formatting Log: Fix yesterday's relative time formatting by using correct ICU API arguments fix: 修复"昨天"相对时间格式错误 1. 使用 UDAT_ABSOLUTE_DAY 替换 UDAT_DIRECTION_LAST + UDAT_RELATIVE_DAYS 2. 移除传递给 formatter->format() 的多余数值参数 3. 确保 ICU API 调用匹配绝对日期格式的正确重载 Log: 修复昨天相对时间格式化问题,使用正确的 ICU API 参数 PMS: BUG-359117 --- panels/notification/common/notifyentity.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/panels/notification/common/notifyentity.cpp b/panels/notification/common/notifyentity.cpp index d0b627797..a97e5136f 100644 --- a/panels/notification/common/notifyentity.cpp +++ b/panels/notification/common/notifyentity.cpp @@ -405,7 +405,7 @@ QString NotifyEntity::formatRelativeTime(qint64 ctimeMs) return toQString(result); } } else if (elapsedDay >= 1 && elapsedDay < 2) { - formatter->format(1, UDAT_DIRECTION_LAST, UDAT_RELATIVE_DAYS, result, status); + formatter->format(UDAT_DIRECTION_LAST, UDAT_ABSOLUTE_DAY, result, status); UnicodeString combinedString; UErrorCode timeStatus = U_ZERO_ERROR; SimpleDateFormat timeFormatter("HH:mm", icu::Locale::getDefault(), timeStatus);