接口添加时间与时区&赔率

This commit is contained in:
xianyi
2026-01-14 15:14:09 +08:00
parent 1bd10694bf
commit 8dc87c9b29
7 changed files with 149 additions and 13 deletions

View File

@@ -34,6 +34,15 @@ export default function HomeScreen() {
const [loadingLeagues, setLoadingLeagues] = useState(false);
const [now, setNow] = useState(() => new Date());
const deviceTimeZone = useMemo(() => {
try {
console.log("deviceTimeZone", Intl.DateTimeFormat().resolvedOptions().timeZone);
return Intl.DateTimeFormat().resolvedOptions().timeZone || "UTC";
} catch {
return "UTC";
}
}, []);
// Selection States
// 默认足球
const [selectedSportId, setSelectedSportId] = useState<number | null>(1);
@@ -158,7 +167,7 @@ export default function HomeScreen() {
const loadMatches = async (sportId: number) => {
setLoading(true);
try {
const list = await fetchTodayMatches(sportId, selectedDate);
const list = await fetchTodayMatches(sportId, selectedDate, deviceTimeZone);
setMatches(list);
} catch (e) {
console.error(e);