←
TRCKR-316
Created: 2025-12-12
•
Updated: 2025-12-16
Relationships
Loading...
Attachments
Loading...
Comments (1)
agent
·
2025-12-12
Fixed the Last Seen column in the agents table to show relative time with abbreviated format and tooltip.
**Changes made:**
- Modified `server/templates/partials/agents_table.html`:
- Line 87-89: Removed `data-date` attribute from the `<td>` element to prevent conflict with the global date formatting in `base.html`
- Line 257-272: Updated `updateRelativeTimes()` JavaScript function to use abbreviated format:
- Under 60 seconds: "X sec ago"
- Under 60 minutes: "X min ago"
- Under 24 hours: "X hr ago"
- Under 7 days: "X days ago"
- After 7 days: shows the date (YYYY-MM-DD)
- Line 270-271: Added tooltip with full datetime in local time using `element.setAttribute('title', localDateTime)`
**Issue discovered:**
The global `applyDateFormatting()` function in `base.html` was processing all elements with `data-date` attribute and setting their textContent directly, which was overwriting the `<span class="relative-time">` structure. The fix was to remove the `data-date` attribute from agent cells so they are only processed by the agents table's own `updateRelativeTimes()` function.
**Verification:**
- Deployed to production at trckr.roboalch.com
- Verified relative time display shows abbreviated format (e.g., "5 min ago", "13 min ago", "2 hr ago")
- Verified tooltip shows full datetime in local time (e.g., "12/11/2025, 9:14:32 PM")
- JavaScript updates every 30 seconds as expected