feat: 部分估值展示内容去除年份

This commit is contained in:
hzm
2026-03-12 20:22:09 +08:00
parent 966c853eb5
commit d00c8cf3eb
4 changed files with 54 additions and 19 deletions

View File

@@ -34,6 +34,17 @@ const getBrowserTimeZone = () => {
const TZ = getBrowserTimeZone();
const toTz = (input) => (input ? dayjs.tz(input, TZ) : dayjs().tz(TZ));
const formatDisplayDate = (value) => {
if (!value) return '-';
const d = toTz(value);
if (!d.isValid()) return value;
const hasTime = /[T\s]\d{2}:\d{2}/.test(String(value));
return hasTime ? d.format('MM-DD HH:mm') : d.format('MM-DD');
};
export default function FundCard({
fund: f,
todayStr,
@@ -126,7 +137,11 @@ export default function FundCard({
<div className="actions">
<div className="badge-v">
<span>{f.noValuation ? '净值日期' : '估值时间'}</span>
<strong>{f.noValuation ? (f.jzrq || '-') : (f.gztime || f.time || '-')}</strong>
<strong>
{f.noValuation
? formatDisplayDate(f.jzrq)
: formatDisplayDate(f.gztime || f.time)}
</strong>
</div>
<div className="row" style={{ gap: 4 }}>
<button