Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
陈剑华
2024-06-17 09:30:17 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
84bcb22bd620f2e609f055d93bd2d832e5328b6e
84bcb22b
1 parent
ced4ceb7
fix: 18033 健康频道-时间轴专题_当天的数据不该展示日期
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
1 deletions
sight_harmony/features/wdComponent/src/main/ets/components/cardview/Card9Component.ets
sight_harmony/features/wdComponent/src/main/ets/components/cardview/Card9Component.ets
View file @
84bcb22
...
...
@@ -63,6 +63,14 @@ export struct Card9Component {
this.textArr = titleInitRes.textArr;
}
formatTime(timeStamp: number) {
let todayDate = new Date().setHours(0,0,0,0);
let paramsDate = new Date(timeStamp).setHours(0,0,0,0);
let isToday = todayDate === paramsDate
let format: string = isToday ? 'HH:mm' : 'MM月dd日 HH:mm';
return DateTimeUtils.formatDate(timeStamp, format)
}
build() {
Column() {
// 顶部标题,最多两行
...
...
@@ -208,7 +216,7 @@ export struct Card9Component {
.margin({ right: 5 })
.fillColor(item.newsTitleColor)
Text(
DateTimeUtils.formatDate(item.publishTime, "MM月dd日 HH:mm"
))
Text(
this.formatTime(item.publishTime
))
.fontSize($r('app.float.font_size_12'))
.fontColor($r('app.color.color_222222'))
.fontWeight(600)
...
...
Please
register
or
login
to post a comment