From f8e71fc3b65bb1b39888668caf9e2d42f4596bde Mon Sep 17 00:00:00 2001 From: thiloho <123883702+thiloho@users.noreply.github.com> Date: Sat, 26 Apr 2025 09:43:01 +0200 Subject: [PATCH] Fix Date component for string from remark --- remark-modified-time.mjs | 4 +-- src/components/Date.astro | 32 +++++++++++++------ .../blog/privacy-focused-operating-systems.md | 2 ++ 3 files changed, 26 insertions(+), 12 deletions(-) diff --git a/remark-modified-time.mjs b/remark-modified-time.mjs index a707eec..f0d8284 100644 --- a/remark-modified-time.mjs +++ b/remark-modified-time.mjs @@ -1,9 +1,9 @@ import { execSync } from "child_process"; export const remarkModifiedTime = () => { - return (tree, file) => { + return (file) => { const filepath = file.history[0]; const result = execSync(`git log -1 --pretty="format:%cI" "${filepath}"`); file.data.astro.frontmatter.lastModified = result.toString(); }; -}; +} \ No newline at end of file diff --git a/src/components/Date.astro b/src/components/Date.astro index 0d19a4e..249ae87 100644 --- a/src/components/Date.astro +++ b/src/components/Date.astro @@ -1,17 +1,29 @@ --- interface Props { - date: Date; + date: Date | string; } const { date } = Astro.props; + +const isStringDate = typeof date === "string"; +const transformedDate = isStringDate ? new Date(date) : date; + +// Create the base options object +const localeOptions = { + year: "numeric", + month: "long", + day: "numeric", +}; + +// Conditionally add time options if it's a string date +if (isStringDate) { + Object.assign(localeOptions, { + hour: "2-digit", + minute: "2-digit" + }); +} --- - + \ No newline at end of file diff --git a/src/content/blog/privacy-focused-operating-systems.md b/src/content/blog/privacy-focused-operating-systems.md index f146a05..ed0f723 100644 --- a/src/content/blog/privacy-focused-operating-systems.md +++ b/src/content/blog/privacy-focused-operating-systems.md @@ -28,6 +28,8 @@ There are other great options, such as [FreeBSD](https://www.freebsd.org) and [O Your main choice here should probably be [GrapheneOS](https://grapheneos.org). +Wikipedia states the following: + > GrapheneOS is an open source, privacy and security-focused Android operating system that runs on selected Google Pixel devices, including smartphones, tablets and foldables. As mentioned in the quote, note that you need a [supported Google Pixel device](https://grapheneos.org/faq#supported-devices) to use GrapheneOS and I would not recommend using any other privacy focused or hardened mobile operating system as they do not come close to its usability while maintaining these aspects.