commit b76588b3a8222d2c6ef610b583f4984b5157bd35
parent fe23471c19c06c2ad6424360fe66304c122daa41
Author: Andreas Gruhler <andreas.gruhler@adfinis.com>
Date: Fri, 1 Nov 2024 18:49:48 +0100
fix(starlist): birthdate format
Diffstat:
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/frontend/Startlist.jsx b/src/frontend/Startlist.jsx
@@ -6,6 +6,7 @@ import Select from 'react-select'
const api_uri = import.meta.env.VITE_API_URI
const api_port = import.meta.env.VITE_API_PORT
+const locale = import.meta.env.VITE_LOCALE
async function addtoHeat(e, athlete, heatId, session) {
e.preventDefault()
@@ -77,6 +78,7 @@ async function getHeat(heatId, session) {
}
function StartlistForm({heatId, session}) {
+ const [loading, setLoading] = useState(false)
const [heatName, setheatName] = useState("")
const [heatLocation, setheatLocation] = useState("")
const [heatStart, setheatStart] = useState("")
@@ -84,7 +86,11 @@ function StartlistForm({heatId, session}) {
const [athleteOpts, setAthleteOpts] = useState([])
const [selectedAthlete, setselectedAthlete] = useState({})
- const [loading, setLoading] = useState(false)
+ const dateOptions = {
+ year: "numeric",
+ month: "2-digit",
+ day: "2-digit",
+ }
useEffect(() => {
(async () => {
@@ -151,7 +157,7 @@ function StartlistForm({heatId, session}) {
<td data-title='Start Nr.' className='right'>{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'>{new Date(i.birthday).toLocaleDateString(locale, dateOptions)}</td>
<td data-title='School'>{i.school}</td>
<td><button onClick={e => removeAthleteFromHeat(
e,