made date localized

This commit is contained in:
ebby 2026-08-18 16:16:33 +02:00
parent c3e2518900
commit a0c895d28b
5 changed files with 8 additions and 5 deletions

View file

@ -11,6 +11,7 @@ interface Props {
const { post, url } = Astro.props;
const img = findImageByPath(post.image.path);
const localeDate = new Date(post.date).toLocaleDateString()
---
<div class="wide-container">
@ -22,7 +23,7 @@ const img = findImageByPath(post.image.path);
<h2 class="headline">{post.title}</h2>
</a>
<div class="top-info">
<span>{post.date}</span>
<span>{localeDate}</span>
<span class="vertical-line"></span>
<span>Autor: {post.author}</span>
</div>

View file

@ -11,6 +11,7 @@ interface Props {
const { post, url } = Astro.props;
const img = findImageByPath(post.image.path)
const localeDate = new Date(post.date).toLocaleDateString()
---
<a href={url} class="no-link-link">
@ -21,7 +22,7 @@ const img = findImageByPath(post.image.path)
<p class="description">{post.description}</p>
<div class="bottom-info">
<span>Author: {post.author}</span>
<span>{post.date}</span>
<span>{localeDate}</span>
</div>
</div>
</a>

View file

@ -12,6 +12,7 @@ interface Props {
const { frontmatter } = Astro.props;
const titleImg = findImageByPath(frontmatter.image.path);
const localeDate = new Date(frontmatter.date).toLocaleDateString()
---
<Main>
@ -27,7 +28,7 @@ const titleImg = findImageByPath(frontmatter.image.path);
<hr />
<div class="bottom-info">
<span>Autor: {frontmatter.author}</span>
<span>{frontmatter.date}</span>
<span>{localeDate}</span>
</div>
<hr />
<slot />

View file

@ -6,7 +6,7 @@ image:
path: ostsee.jpg
alt: Chiara und Tim vor einem Strand
author: Tim
date: '2026-08-XX'
date: '2026-08-18'
---
Eigentlich soll es hier um unser (zukünftiges) Boot und die Segelreisen gehen.

View file

@ -2,7 +2,7 @@ export interface Post {
title: String,
subtitle: String,
description: String,
date: String,
date: string,
author: String,
image: {
path: string,