修改 列表 时间格式化问题

This commit is contained in:
张成
2025-10-18 20:17:31 +08:00
parent da72c92458
commit 9f5fdfd1a5
5 changed files with 239 additions and 30 deletions

View File

@@ -2,12 +2,14 @@ import { View, Text, Image } from "@tarojs/components";
import Taro from "@tarojs/taro";
import img from "../../config/images";
import { ListCardProps } from "../../../types/list/types";
import { formatGameTime, calculateDuration } from "@/utils/timeUtils";
import "./index.scss";
const ListCard: React.FC<ListCardProps> = ({
id,
title,
start_time,
end_time,
location,
distance_km,
current_players,
@@ -112,7 +114,11 @@ const ListCard: React.FC<ListCardProps> = ({
{/* 时间信息 */}
<View className="date-time">
<Text>{start_time}</Text>
<Text>{formatGameTime(start_time)}</Text>
{/* 时长 如 2小时 */}
{end_time && (
<Text> {calculateDuration(start_time, end_time)}</Text>
)}
</View>
{/* 地点,室内外,距离 */}