From 437c0e173ba7a255ed9c8ba60bc6aca91bc3c986 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fe=CC=81lix=20Pe=CC=81ault?= Date: Sat, 9 Oct 2021 12:04:48 +0200 Subject: [PATCH] Add relative date from latest photo on Location page --- src/routes/[country]/[location]/index.svelte | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/routes/[country]/[location]/index.svelte b/src/routes/[country]/[location]/index.svelte index 7ec0d94..4706b61 100644 --- a/src/routes/[country]/[location]/index.svelte +++ b/src/routes/[country]/[location]/index.svelte @@ -2,6 +2,7 @@ import { page } from '$app/stores' import dayjs from 'dayjs' import advancedFormat from 'dayjs/plugin/advancedFormat' + import relativeTime from 'dayjs/plugin/relativeTime' import { getAssetUrl } from '$utils/helpers' // Components import Button from '$components/atoms/Button.svelte' @@ -12,6 +13,7 @@ export let photos: any dayjs.extend(advancedFormat) + dayjs.extend(relativeTime) const { params } = $page let descriptionEl: HTMLElement @@ -54,7 +56,11 @@ {/each}

· -

Updated [10] days ago

+

+ Updated +

@@ -141,11 +147,12 @@ photo (filter: { location: { slug: { _eq: "${location}" } }}) { title slug - date_taken image { id title } + date_taken + date_created } } `)