statistics: Better display on the front page
This commit is contained in:
parent
bc1bf0db1c
commit
9a1cf4e53b
12 changed files with 181 additions and 59 deletions
|
|
@ -1,7 +1,17 @@
|
|||
import dayjs from "dayjs"
|
||||
const types: Record<string, (element: HTMLElement) => HTMLElement | string> = {
|
||||
"date": (element) => {
|
||||
return dayjs(element.innerText).format('YYYY-MM-DD HH:mm:ss ([UTC]Z)')
|
||||
const value = dayjs(element.innerText);
|
||||
const text = value.format('YYYY-MM-DD HH:mm:ss ([UTC]Z)')
|
||||
|
||||
// if the date is the zero date, then it is assumed to be invalid
|
||||
if (value.unix() === 0) {
|
||||
const code = document.createElement('code')
|
||||
code.style.color = 'gray'
|
||||
code.append(text)
|
||||
return code
|
||||
}
|
||||
return text
|
||||
},
|
||||
"path": (element) => {
|
||||
const text = element.innerText.split("/");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue