Time in a more human readable format

This commit is contained in:
ari 2025-04-21 00:42:32 -04:00 committed by Astra
parent 1e04628fdf
commit 5da1494081
No known key found for this signature in database
3 changed files with 12 additions and 2 deletions

View file

@ -2,6 +2,7 @@
import { Post } from "./pdsfetch";
import { Config } from "../../config";
import { onMount } from "svelte";
import moment from "moment";
let { post }: { post: Post } = $props();
@ -76,7 +77,9 @@
<a
id="postLink"
href="{Config.FRONTEND_URL}/profile/{post.authorDid}/post/{post.recordName}"
>{post.timenotstamp}</a
>{moment(post.timenotstamp).isBefore(moment().subtract(1, 'month'))
? moment(post.timenotstamp).format('MMM D, YYYY')
: moment(post.timenotstamp).fromNow()}</a
>
</p>
</div>
@ -131,6 +134,7 @@
</div>
{/if}
{#if post.videosLinkCid}
<!-- svelte-ignore a11y_media_has_caption -->
<video
id="embedVideo"
src="{Config.PDS_URL}/xrpc/com.atproto.sync.getBlob?did={post.authorDid}&cid={post.videosLinkCid}"