mirror of
https://github.com/thiloho/thiloho.github.io.git
synced 2025-11-22 02:11:35 +01:00
Fix Date component for string from remark
This commit is contained in:
@@ -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();
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -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"
|
||||
});
|
||||
}
|
||||
---
|
||||
|
||||
<time datetime={date.toISOString()}>
|
||||
{
|
||||
date.toLocaleString("en-us", {
|
||||
year: "numeric",
|
||||
month: "long",
|
||||
day: "numeric",
|
||||
})
|
||||
}
|
||||
<time datetime={transformedDate.toISOString()}>
|
||||
{transformedDate.toLocaleString("en-us", localeOptions)}
|
||||
</time>
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user