I9NIG3【OpenHarmony 4.1.7.7】【应用子系统】【RK3568】【必现_5/5】设置24小时制时间,状态栏和通知中心依然显示12小时制

Signed-off-by: 王环 <18108170464@163.com>
This commit is contained in:
王环 2024-05-29 17:11:18 +08:00
parent 41bfb09f3e
commit 28e798cfe5

View File

@ -23,6 +23,7 @@ import createOrGet from "./SingleInstanceHelper";
import { obtainLocalEvent } from "./event/EventUtil";
import Constants from "./Constants";
import { CommonEventManager, getCommonEventManager, POLICY } from "./commonEvent/CommonEventManager";
import i18n from '@ohos.i18n';
export const TIME_CHANGE_EVENT = "Time_Change_Event";
@ -73,6 +74,7 @@ class TimeManager {
}
public formatTime(date: Date) {
this.mUse24hFormat = i18n.System.is24HourClock();
return concatTime(date.getHours() % (this.mUse24hFormat ? 24 : 12), date.getMinutes());
}