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

View file

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

View file

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

View file

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

View file

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