Improve nearby station timing labels
This commit is contained in:
@@ -2162,10 +2162,10 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
margin-top: 2px;
|
||||
font-size: 8px;
|
||||
margin-top: 3px;
|
||||
font-size: 10px;
|
||||
font-weight: 700;
|
||||
color: rgba(148, 163, 184, 0.88);
|
||||
color: rgba(203, 213, 225, 0.95);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
|
||||
@@ -140,13 +140,13 @@ function buildNearbyIconHtml(detail: CityDetail, station: NearbyStation) {
|
||||
const symbol = detail.temp_symbol || "°C";
|
||||
const formatObsTime = () => {
|
||||
const label = String(station.obs_time_label || "").trim();
|
||||
if (label) return label;
|
||||
if (label) return label.replace(/Z$/i, "");
|
||||
const raw = String(station.obs_time || "").trim();
|
||||
if (!raw) return "";
|
||||
if (raw.endsWith("Z") || raw.includes("+00:00")) {
|
||||
const parsed = new Date(raw);
|
||||
if (!Number.isNaN(parsed.getTime())) {
|
||||
return `${String(parsed.getUTCHours()).padStart(2, "0")}:${String(parsed.getUTCMinutes()).padStart(2, "0")}Z`;
|
||||
return `${String(parsed.getUTCHours()).padStart(2, "0")}:${String(parsed.getUTCMinutes()).padStart(2, "0")}`;
|
||||
}
|
||||
}
|
||||
if (raw.includes("T")) return raw.split("T").pop()?.slice(0, 5) || "";
|
||||
|
||||
Reference in New Issue
Block a user