From 9851697b583efdd40173ebbdd484030f2adb0732 Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Thu, 24 Aug 2023 16:05:19 +0000
Subject: [PATCH] version bump to 4.0.10
---
quartz/components/Date.tsx | 20 ++++++++++++++++----
1 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/quartz/components/Date.tsx b/quartz/components/Date.tsx
index 7ea6ad4..0530a37 100644
--- a/quartz/components/Date.tsx
+++ b/quartz/components/Date.tsx
@@ -1,12 +1,24 @@
+import { GlobalConfiguration } from "../cfg"
+import { QuartzPluginData } from "../plugins/vfile"
+
interface Props {
date: Date
}
-export function Date({ date }: Props) {
- const formattedDate = date.toLocaleDateString('en-US', {
+export type ValidDateType = keyof Required<QuartzPluginData>["dates"]
+
+export function getDate(cfg: GlobalConfiguration, data: QuartzPluginData): Date | undefined {
+ return data.dates?.[cfg.defaultDateType]
+}
+
+export function formatDate(d: Date): string {
+ return d.toLocaleDateString("en-US", {
year: "numeric",
month: "short",
- day: '2-digit'
+ day: "2-digit",
})
- return <>{formattedDate}</>
+}
+
+export function Date({ date }: Props) {
+ return <>{formatDate(date)}</>
}
--
Gitblit v1.10.0