diff --git a/src/App.vue b/src/App.vue index 66e6961..cc0e0c2 100644 --- a/src/App.vue +++ b/src/App.vue @@ -144,7 +144,7 @@ async function updateWall() { */ const filteredPosts = computed(() => { // Copy to make sure those are detected as a reactive dependencies - var posts: Array = JSON.parse(JSON.stringify(allPosts.value)) + var posts: Array = [... allPosts.value] const pinnedLocal = [...pinned.value] const hiddenLocal = [...hidden.value] @@ -160,12 +160,11 @@ const filteredPosts = computed(() => { posts = posts.sort((a, b) => { const aPinned = a.pinned ? 1 : 0 const bPinned = b.pinned ? 1 : 0 - return bPinned - aPinned || new Date(b.date).getTime() - new Date(a.date).getTime() + return bPinned - aPinned || b.date.getTime() - a.date.getTime() }) return posts }) - function toggle(array: T[], value: T) { if (array.includes(value)) array.splice(array.indexOf(value), 1) diff --git a/src/components/Card.vue b/src/components/Card.vue index 42e852a..f426ed6 100644 --- a/src/components/Card.vue +++ b/src/components/Card.vue @@ -51,7 +51,7 @@ const onMediaLoad = inject('fixLayout', () => undefined)

-

{{ timeAgo }}

diff --git a/src/sources.ts b/src/sources.ts index 132d3a4..f0a764c 100644 --- a/src/sources.ts +++ b/src/sources.ts @@ -218,7 +218,7 @@ const filterStatus = (cfg: Config, status: MastodonStatus) => { * Convert a mastdon status object to a Post. */ const statusToWallPost = (cfg: Config, status: MastodonStatus): Post => { - const date = status.created_at + const date = new Date(status.created_at) if (status.reblog) status = status.reblog diff --git a/src/types.ts b/src/types.ts index f2a27f2..a0d083a 100644 --- a/src/types.ts +++ b/src/types.ts @@ -30,7 +30,7 @@ export type Post = { id: string; url: string; content: string; - date: string; + date: Date; author?: { name: string; diff --git a/src/utils.ts b/src/utils.ts index 58bc6f7..ec5e24a 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -29,7 +29,7 @@ export function deepClone(obj: any) { * a string or a new DOM node. Can be used to replace emojis with images or * URLs with links. * - * The root node is modifed in-place and then returned. + * The root node is modifed in-place and also returned. */ export function replaceInText(root: Node, pattern: RegExp, replace: (m: RegExpMatchArray) => string | Node) { const walk = (node: Node) => {