···22 import { onMount } from 'svelte';
33 import { fade } from 'svelte/transition';
44 export let data;
55- console.log(data);
66- let lastUpdated = new Date(data.posts[0].meta.date);
77- let lastUpdatedString = `${lastUpdated.getDay()}/${lastUpdated.getMonth()}/${lastUpdated.getFullYear()}`;
55+ const date = new Date(data.posts[0].meta.date);
66+ let dateString = `${date.getFullYear()}/${date.getMonth() + 1}/${date.getDate()}`;
87 let messages = [
98 'This is a blog. Sometimes I write stuff.',
109 'This is a blog. I write stuff here.',
···1413 'This is a blog. Thank you for reading!',
1514 'This is a blog... or is it?',
1615 'This is a blog. It is written in Svelte and SvelteKit.',
1717- `This is a blog. It was last updated on ${lastUpdatedString}.`,
1616+ `This is a blog. It was last updated on ${dateString}.`,
1817 'This is, unsurprisingly, a blog.'
1918 ];
2019
+3-1
src/routes/post/[slug]/+page.svelte
···11<script>
22 export let data;
33+ const date = new Date(data.date);
44+ let dateString = `${date.getFullYear()}/${date.getMonth() + 1}/${date.getDate()}`;
35</script>
4657<svelte:head>
···911<main>
1012 <article>
1113 <h1>{data.title}</h1>
1212- <h2>{data.date}</h2>
1414+ <h2>{dateString}</h2>
1315 <br />
1416 <svelte:component this={data.content} />
1517 </article>