feat: add some relativedate error handling

This commit is contained in:
Xyphyn committed 2023-09-04 15:01:08 -07:00
1 parent d6b5bfe3bb
commit 6afe926d4d
7 files changed
+23 -7

No files matched your search

+2 -1
View File
@@ -4,6 +4,7 @@
import StickyCard from '$lib/components/ui/StickyCard.svelte'
import FormattedNumber from '$lib/components/util/FormattedNumber.svelte'
import RelativeDate from '$lib/components/util/RelativeDate.svelte'
import { publishedToDate } from '$lib/components/util/date.js'
import { getClient } from '$lib/lemmy.js'
import type { PersonView, SiteView, Tagline } from 'lemmy-js-client'
import { Button, Popover } from 'mono-svelte'
@@ -35,7 +36,7 @@
</div>
<span class="flex flex-row items-center gap-1 text-sm">
<Icon src={Calendar} width={16} height={16} mini />
<RelativeDate date={new Date(site.site.published + 'Z')} />
<RelativeDate date={publishedToDate(site.site.published)} />
</span>
<div class="text-sm flex flex-row flex-wrap gap-3">
<span class="flex flex-row items-center gap-1">
@@ -18,6 +18,7 @@
import { toast } from 'mono-svelte'
import { profile } from '$lib/auth.js'
import { Button, Modal } from 'mono-svelte'
import { publishedToDate } from '$lib/components/util/date.js'
export let node: CommentNodeI
export let postId: number
@@ -102,7 +103,7 @@
</div>
{/if}
<RelativeDate
date={new Date(node.comment_view.comment.published + 'Z')}
date={publishedToDate(node.comment_view.comment.published)}
/>
<span>•</span>
<span>
@@ -22,6 +22,7 @@
Plus,
UserGroup,
} from 'svelte-hero-icons'
import { publishedToDate } from '$lib/components/util/date.js'
export let community_view: CommunityView
export let moderators: CommunityModeratorView[]
@@ -93,7 +94,7 @@
</div>
<span class="flex flex-row items-center gap-1 text-sm">
<Icon src={Calendar} width={16} height={16} mini />
<RelativeDate date={new Date(community_view.community.published + 'Z')} />
<RelativeDate date={publishedToDate(community_view.community.published)} />
</span>
<div class="text-sm flex flex-row flex-wrap gap-3">
<span class="flex flex-row items-center gap-1">