Fix city-local nearby station time labels

This commit is contained in:
2569718930@qq.com
2026-04-19 18:45:25 +08:00
parent d6cc3b1b90
commit d1fa49ee35
4 changed files with 32 additions and 2 deletions
+2 -1
View File
@@ -216,6 +216,8 @@ function buildNearbyIconHtml(detail: CityDetail, station: NearbyStation) {
const utcOffsetSeconds = getDetailUtcOffsetSeconds(detail);
const formatObsTime = () => {
const raw = String(station.obs_time || "").trim();
const label = String(station.obs_time_label || "").trim();
if (station.obs_time_display_tz === "city_local" && label) return label.replace(/Z$/i, "");
const epochRaw = Number(station.obs_time_epoch);
const epochMs = Number.isFinite(epochRaw)
? epochRaw > 1_000_000_000_000
@@ -226,7 +228,6 @@ function buildNearbyIconHtml(detail: CityDetail, station: NearbyStation) {
const localOffsetSeconds = utcOffsetSeconds;
return formatCityLocalDateTime(epochMs, localOffsetSeconds, detail.local_date, isEnglishUi);
}
const label = String(station.obs_time_label || "").trim();
if (label) return label.replace(/Z$/i, "");
if (!raw) return "";
if (raw.endsWith("Z") || raw.includes("+00:00")) {
+1
View File
@@ -121,6 +121,7 @@ export interface NearbyStation {
obs_time?: string | null;
obs_time_epoch?: number | string | null;
obs_time_label?: string | null;
obs_time_display_tz?: "city_local" | string | null;
age_minutes?: number | null;
time_delta_vs_anchor_minutes?: number | null;
sync_status?: "synced" | "near_realtime" | "lagged" | "stale" | "unknown" | string | null;