feat(front/file-uploader): display human readable time in file list

This commit is contained in:
Alice Gaudon 2022-03-02 11:21:23 +01:00
parent 9807158bb9
commit a8f82564a5

View File

@ -9,6 +9,7 @@
import Message from "./components/Message.svelte"; import Message from "./components/Message.svelte";
import Icon from "./utils/Icon.svelte" import Icon from "./utils/Icon.svelte"
import FileUpload from "./components/FileUpload.svelte"; import FileUpload from "./components/FileUpload.svelte";
import {Time} from "../../common/Time.js";
let neverExpire: string; let neverExpire: string;
let autogenUrl: string; let autogenUrl: string;
@ -197,7 +198,7 @@
<th>#</th> <th>#</th>
<th class="table-col-grow">Name</th> <th class="table-col-grow">Name</th>
<th>Size</th> <th>Size</th>
<th>Expires at</th> <th>Expires in</th>
<th>Actions</th> <th>Actions</th>
</tr> </tr>
</thead> </thead>
@ -211,8 +212,14 @@
</a></td> </a></td>
<td>{(file.size / (1024 * 1024)).toFixed(2)}MB</td> <td>{(file.size / (1024 * 1024)).toFixed(2)}MB</td>
<td> <td>
{#if file.expires_at}{file.expires_at}{:else}Never{/if} {#if file.expires_at}
</td><!-- todo: convert that to relative, human readable time --> <time datetime="{file.expires_at}" title="{file.expires_at}">
{Time.humanizeTimeTo(new Date(file.expires_at))}
</time>
{:else}
Never
{/if}
</td>
<td class="actions"> <td class="actions">
{#if file.shouldBeDeleted} {#if file.shouldBeDeleted}
Pending deletion Pending deletion