mirror of
https://github.com/CringeStudios/element-desktop.git
synced 2025-01-31 05:29:58 +01:00
Update generate-packages-index.ts
This commit is contained in:
parent
3bf4e37b22
commit
e270bb7071
@ -101,6 +101,14 @@ function humanFileSize(bytes: number, si = false, dp = 1) {
|
|||||||
return bytes.toFixed(dp) + ' ' + units[u];
|
return bytes.toFixed(dp) + ' ' + units[u];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const dateTimeOptions = {
|
||||||
|
year: "numeric",
|
||||||
|
month: "short",
|
||||||
|
day: "2-digit",
|
||||||
|
hour: "2-digit",
|
||||||
|
minute: "numeric",
|
||||||
|
};
|
||||||
|
|
||||||
function indexLayout(prefix: string, files: _Object[], dirs: string[]): string {
|
function indexLayout(prefix: string, files: _Object[], dirs: string[]): string {
|
||||||
const rows: [link: string, name: string, size?: number, date?: Date][] = [];
|
const rows: [link: string, name: string, size?: number, date?: Date][] = [];
|
||||||
|
|
||||||
@ -138,13 +146,7 @@ function indexLayout(prefix: string, files: _Object[], dirs: string[]): string {
|
|||||||
${rows.map(([link, name, size, date]) => `<tr>
|
${rows.map(([link, name, size, date]) => `<tr>
|
||||||
<td class="link"><a href="${link}">${name}</a></td>
|
<td class="link"><a href="${link}">${name}</a></td>
|
||||||
<td class="size">${size ? humanFileSize(size) : "-"}</td>
|
<td class="size">${size ? humanFileSize(size) : "-"}</td>
|
||||||
<td class="date">${date?.toLocaleString("en-GB", {
|
<td class="date">${date?.toLocaleString("en-GB", dateTimeOptions) ?? "-"}</td>
|
||||||
year: "numeric",
|
|
||||||
month: "short",
|
|
||||||
day: "2-digit",
|
|
||||||
hour: "2-digit",
|
|
||||||
minute: "numeric",
|
|
||||||
}) ?? "-"}</td>
|
|
||||||
</tr>`).join("")}
|
</tr>`).join("")}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user