🚸 (results) Improve submitted at field parsing
This commit is contained in:
@@ -70,10 +70,19 @@ export const convertResultsToTableData = (
|
|||||||
}, {}),
|
}, {}),
|
||||||
}))
|
}))
|
||||||
|
|
||||||
const convertDateToReadable = (date: Date): string =>
|
const convertDateToReadable = (date: Date): string => {
|
||||||
date.toDateString().split(' ').slice(1, 3).join(' ') +
|
const isThisYear = new Date().getFullYear() === date.getFullYear()
|
||||||
', ' +
|
|
||||||
date.toLocaleTimeString([], {
|
const dateString = date.toLocaleDateString('default', {
|
||||||
|
month: 'short',
|
||||||
|
day: 'numeric',
|
||||||
|
year: isThisYear ? undefined : 'numeric', // Only show the year if it's not the current year
|
||||||
|
})
|
||||||
|
|
||||||
|
const timeString = date.toLocaleTimeString('default', {
|
||||||
hour: '2-digit',
|
hour: '2-digit',
|
||||||
minute: '2-digit',
|
minute: '2-digit',
|
||||||
})
|
})
|
||||||
|
|
||||||
|
return `${dateString}, ${timeString}`
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user