myheats

Live heats, scoring and leaderboard for sport events
git clone https://git.in0rdr.ch/myheats.git
Log | Files | Refs | Pull requests | README | LICENSE

commit 7a9b8e3ff4e6520c3f7f9f48a9b5abc6b5d4b7eb
parent b13a366ef78a8485adad63a2363b87d1591564ca
Author: Andreas Gruhler <andreas.gruhler@adfinis.com>
Date:   Sat, 28 Sep 2024 17:18:29 +0200

fix(leaderboard): bday locale

Diffstat:
Msrc/frontend/Leaderboard.jsx | 10+++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/frontend/Leaderboard.jsx b/src/frontend/Leaderboard.jsx @@ -8,6 +8,8 @@ const api_port = import.meta.env.VITE_API_PORT const ws_uri = import.meta.env.VITE_WS_URI const ws_port = import.meta.env.VITE_WS_PORT +const locale = import.meta.env.VITE_LOCALE + // use a socket for the real-time leaderboard data let socket = new WebSocket(`${ws_uri}:${ws_port}/v1/leaderboard`); console.info("Attached to server websocket"); @@ -257,6 +259,12 @@ function Leaderboard({session}) { const selectHeatRef = useRef(); const selectRankRef = useRef(); + const dateOptions = { + year: "numeric", + month: "2-digit", + day: "2-digit", + } + // add options to select or rank by heat const heatOpts = heats.map(h => { return { @@ -398,7 +406,7 @@ function Leaderboard({session}) { <td data-title='Start Nr.'>{i.nr}</td> <td data-title='Firstname'>{i.firstname}</td> <td data-title='Lastname'>{i.lastname}</td> - <td data-title='Birthday'>{i.birthday}</td> + <td data-title='Birthday'>{i.birthday ? new Date(i.birthday).toLocaleDateString(locale, dateOptions) : ''}</td> <td data-title='School'>{i.school}</td> {heatSelection.map(h => ( <Fragment key={h.value}>