From 56c8e8d69c78d4d972db1d1fb7f328f8171125b4 Mon Sep 17 00:00:00 2001 From: zhaolu <1977573921@qq.com> Date: Thu, 21 Aug 2025 14:13:18 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=8B=B1=E6=96=87?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F=E4=B8=8B=EF=BC=8C=E9=80=9A=E7=9F=A5=E4=B8=AD?= =?UTF-8?q?=E5=BF=83=E6=97=A5=E6=9C=9F=E6=A0=BC=E5=BC=8F=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhaolu <1977573921@qq.com> --- common/src/main/ets/default/TimeManager.ts | 8 ++++++++ .../dropdownpanel/src/main/ets/pages/notification.ets | 6 +----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/common/src/main/ets/default/TimeManager.ts b/common/src/main/ets/default/TimeManager.ts index 6a5c81ca..4b409e4b 100644 --- a/common/src/main/ets/default/TimeManager.ts +++ b/common/src/main/ets/default/TimeManager.ts @@ -23,6 +23,8 @@ 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'; +import intl from "@ohos.intl"; export const TIME_CHANGE_EVENT = "Time_Change_Event"; @@ -76,6 +78,12 @@ class TimeManager { return concatTime(date.getHours() % (this.mUse24hFormat ? 24 : 12), date.getMinutes()); } + public formatDate(date: Date): string { + let config: intl.DateTimeOptions = { weekday: 'long', month: 'long', day: 'numeric' }; + let dateTimeFormat: intl.DateTimeFormat = new intl.DateTimeFormat(i18n.System.getSystemLanguage(), config); + return dateTimeFormat.format(date); + } + private async initTimeFormat(context: any): Promise { Log.showDebug(TAG, "initTimeFormat"); settings.getValueSync(context, TIME_FORMAT_KEY, "24"); diff --git a/product/phone/dropdownpanel/src/main/ets/pages/notification.ets b/product/phone/dropdownpanel/src/main/ets/pages/notification.ets index f5b8ed56..8dea742a 100644 --- a/product/phone/dropdownpanel/src/main/ets/pages/notification.ets +++ b/product/phone/dropdownpanel/src/main/ets/pages/notification.ets @@ -270,11 +270,7 @@ struct CenterTitle { async updateTimeString(date: Date) { this.mTime = TimeManager.formatTime(date); Log.showDebug(TAG, ` month is ${date.getMonth() + 1} , day is ${date.getDate()} , week is ${Constants.WEEKDAY_LIST[date.getDay() - 1]}`); - await ResourceUtil.initResourceManager(AbilityManager.ABILITY_NAME_DROPDOWN_PANEL); - let timeString = (date.getMonth() + 1) + (await ResourceUtil.getString($r('app.string.month'))); - timeString += date.getDate() + (await ResourceUtil.getString($r('app.string.day'))); - timeString += await ResourceUtil.getString(Constants.WEEKDAY_LIST[date.getDay()]); - this.mTimeString = timeString; + this.mTimeString = TimeManagere.formatDate(date); } settingClick() { -- Gitee From c0de4896e0fd78ac71ad891ddbb642db7a993e77 Mon Sep 17 00:00:00 2001 From: 18742519662 <1977573921@qq.com> Date: Thu, 21 Aug 2025 06:44:30 +0000 Subject: [PATCH 2/3] update product/phone/dropdownpanel/src/main/ets/pages/notification.ets. Signed-off-by: 18742519662 <1977573921@qq.com> --- product/phone/dropdownpanel/src/main/ets/pages/notification.ets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/product/phone/dropdownpanel/src/main/ets/pages/notification.ets b/product/phone/dropdownpanel/src/main/ets/pages/notification.ets index 8dea742a..5d48746f 100644 --- a/product/phone/dropdownpanel/src/main/ets/pages/notification.ets +++ b/product/phone/dropdownpanel/src/main/ets/pages/notification.ets @@ -270,7 +270,7 @@ struct CenterTitle { async updateTimeString(date: Date) { this.mTime = TimeManager.formatTime(date); Log.showDebug(TAG, ` month is ${date.getMonth() + 1} , day is ${date.getDate()} , week is ${Constants.WEEKDAY_LIST[date.getDay() - 1]}`); - this.mTimeString = TimeManagere.formatDate(date); + this.mTimeString = TimeManager.formatDate(date); } settingClick() { -- Gitee From ae0a0b8bce3b3ae06267e0fb9103f86641e7c316 Mon Sep 17 00:00:00 2001 From: zhaolu <1977573921@qq.com> Date: Thu, 21 Aug 2025 15:23:57 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BD=8D=E7=BD=AE?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E5=BC=80=E5=85=B3=E7=8A=B6=E6=80=81=E5=8F=96?= =?UTF-8?q?=E6=B6=88=E7=9B=91=E5=90=AC=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhaolu <1977573921@qq.com> --- .../src/main/ets/com/ohos/model/LocationService.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/features/locationcomponent/src/main/ets/com/ohos/model/LocationService.ts b/features/locationcomponent/src/main/ets/com/ohos/model/LocationService.ts index b88e8a05..36de38e0 100644 --- a/features/locationcomponent/src/main/ets/com/ohos/model/LocationService.ts +++ b/features/locationcomponent/src/main/ets/com/ohos/model/LocationService.ts @@ -51,9 +51,7 @@ export class LocationService { Log.showInfo(TAG, 'stopService'); this.mIsStart = false; try { - geolocation.off('locationEnabledChange', (state: boolean) => { - Log.showInfo(TAG, `stopService locationChange, state: ${JSON.stringify(state)}`) - }); + geolocation.off('locationEnabledChange'); } catch { Log.showError(TAG, 'geolocation.off try-catch error'); } -- Gitee