1import { Controller } from "@hotwired/stimulus" 2 3export default class extends Controller { 4 connect() { 5 this.element.querySelectorAll("[data-time]").forEach((el) => { 6 const date = new Date(el.dataset.time) 7 if (isNaN(date)) return 8 9 // Skip if the user's UTC offset matches the group's â same time, no need for brackets 10 const match = el.dataset.time.match(/([+-])(\d{2}):(\d{2})$/) 11 if (match) { 12 const sign = match[1] === "+" ? 1 : -1 13 const groupOffsetMinutes = sign * (parseInt(match[2]) * 60 + parseInt(match[3])) 14 const userOffsetMinutes = -date.getTimezoneOffset() 15 if (groupOffsetMinutes === userOffsetMinutes) return 16 } 17 18 const localTime = new Intl.DateTimeFormat(undefined, { 19 hour: "numeric", 20 minute: "2-digit", 21 hour12: true, 22 timeZoneName: "short", 23 }).format(date) 24 25 el.textContent = `${el.textContent.trim()} (${localTime})` 26 }) 27 } 28};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.