mirror of
https://github.com/ipnet-mesh/meshcore-hub.git
synced 2026-03-28 17:42:56 +01:00
Move timezone display to page headers instead of each timestamp
- Remove timezone abbreviation from datetime format strings - Add timezone label to page headers (Nodes, Messages, Advertisements, Map) - Only show timezone when not UTC to reduce clutter Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -44,7 +44,7 @@ def _create_timezone_filters(tz_name: str) -> dict:
|
||||
|
||||
def format_datetime(
|
||||
value: str | datetime | None,
|
||||
fmt: str = "%Y-%m-%d %H:%M:%S %Z",
|
||||
fmt: str = "%Y-%m-%d %H:%M:%S",
|
||||
) -> str:
|
||||
"""Format a UTC datetime string or object to the configured timezone.
|
||||
|
||||
@@ -79,7 +79,7 @@ def _create_timezone_filters(tz_name: str) -> dict:
|
||||
# Fallback to original value if parsing fails
|
||||
return str(value)[:19].replace("T", " ") if value else "-"
|
||||
|
||||
def format_time(value: str | datetime | None, fmt: str = "%H:%M:%S %Z") -> str:
|
||||
def format_time(value: str | datetime | None, fmt: str = "%H:%M:%S") -> str:
|
||||
"""Format just the time portion in the configured timezone."""
|
||||
return format_datetime(value, fmt)
|
||||
|
||||
@@ -89,10 +89,10 @@ def _create_timezone_filters(tz_name: str) -> dict:
|
||||
|
||||
return {
|
||||
"localtime": format_datetime,
|
||||
"localtime_short": lambda v: format_datetime(v, "%Y-%m-%d %H:%M %Z"),
|
||||
"localtime_short": lambda v: format_datetime(v, "%Y-%m-%d %H:%M"),
|
||||
"localdate": format_date,
|
||||
"localtimeonly": format_time,
|
||||
"localtimeonly_short": lambda v: format_time(v, "%H:%M %Z"),
|
||||
"localtimeonly_short": lambda v: format_time(v, "%H:%M"),
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -7,7 +7,10 @@
|
||||
{% block content %}
|
||||
<div class="flex items-center justify-between mb-6">
|
||||
<h1 class="text-3xl font-bold">Advertisements</h1>
|
||||
<span class="badge badge-lg">{{ total }} total</span>
|
||||
<div class="flex items-center gap-2">
|
||||
{% if timezone and timezone != 'UTC' %}<span class="text-sm opacity-60">{{ timezone }}</span>{% endif %}
|
||||
<span class="badge badge-lg">{{ total }} total</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if api_error %}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
<div class="flex items-center justify-between mb-6">
|
||||
<h1 class="text-3xl font-bold">Map</h1>
|
||||
<div class="flex items-center gap-2">
|
||||
{% if timezone and timezone != 'UTC' %}<span class="text-sm opacity-60">{{ timezone }}</span>{% endif %}
|
||||
<span id="node-count" class="badge badge-lg">Loading...</span>
|
||||
<span id="filtered-count" class="badge badge-lg badge-ghost hidden"></span>
|
||||
</div>
|
||||
|
||||
@@ -7,7 +7,10 @@
|
||||
{% block content %}
|
||||
<div class="flex items-center justify-between mb-6">
|
||||
<h1 class="text-3xl font-bold">Messages</h1>
|
||||
<span class="badge badge-lg">{{ total }} total</span>
|
||||
<div class="flex items-center gap-2">
|
||||
{% if timezone and timezone != 'UTC' %}<span class="text-sm opacity-60">{{ timezone }}</span>{% endif %}
|
||||
<span class="badge badge-lg">{{ total }} total</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if api_error %}
|
||||
|
||||
@@ -7,7 +7,10 @@
|
||||
{% block content %}
|
||||
<div class="flex items-center justify-between mb-6">
|
||||
<h1 class="text-3xl font-bold">Nodes</h1>
|
||||
<span class="badge badge-lg">{{ total }} total</span>
|
||||
<div class="flex items-center gap-2">
|
||||
{% if timezone and timezone != 'UTC' %}<span class="text-sm opacity-60">{{ timezone }}</span>{% endif %}
|
||||
<span class="badge badge-lg">{{ total }} total</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if api_error %}
|
||||
|
||||
Reference in New Issue
Block a user