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
yuzhilin
2024-05-07 16:58:24 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
9d63ec1c2106c2f7092ebd2f2311613c1140e583
9d63ec1c
1 parent
c85b7369
fix:16870 版面稿件详情页,顶部logo、发稿时间展示不对
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
1 deletions
sight_harmony/commons/wdKit/src/main/ets/utils/DateTimeUtils.ts
sight_harmony/features/wdComponent/src/main/ets/components/ImageAndTextPageComponent.ets
sight_harmony/commons/wdKit/src/main/ets/utils/DateTimeUtils.ts
View file @
9d63ec1
...
...
@@ -509,6 +509,26 @@ export class DateTimeUtils {
}
return
num
;
}
/**
* 去除发布日期前导零
* @param dateTimeString 2024年01月01日 00:00
* @returns 2024年1月1日 00:00
*/
static
removeTrailingZeros
(
dateTimeString
:
string
)
{
// 分割日期时间字符串
const
[
datePart
,
timePart
]
=
dateTimeString
.
split
(
' '
);
// 分割日期
const
[
year
,
month
,
day
]
=
datePart
.
match
(
/
\d
+/g
);
// 去除年和月后面的零
const
trimmedMonth
=
parseInt
(
month
,
10
);
const
trimmedDay
=
parseInt
(
day
,
10
);
// 重新组合日期时间字符串
const
newDateTimeString
=
`
$
{
year
}
年
$
{
trimmedMonth
}
月
$
{
trimmedDay
}
日
$
{
timePart
}
`
;
return
newDateTimeString
;
}
}
// const dateTimeUtils = new DateTimeUtils()
\ No newline at end of file
...
...
sight_harmony/features/wdComponent/src/main/ets/components/ImageAndTextPageComponent.ets
View file @
9d63ec1
...
...
@@ -204,7 +204,8 @@ export struct ImageAndTextPageComponent {
this.contentDetailData = detailBeans;
let dateTime =
DateTimeUtils.parseDate(this.contentDetailData[0]?.publishTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN);
this.publishTime = DateTimeUtils.formatDate(dateTime, PATTERN_DATE_CN_RN)
let _publishTime = DateTimeUtils.formatDate(dateTime, PATTERN_DATE_CN_RN)
this.publishTime = DateTimeUtils.removeTrailingZeros(_publishTime)
if (this.contentDetailData[0]?.recommendShow === 1) {
this.getRecommend()
}
...
...
Please
register
or
login
to post a comment