modify locale, timestamps

This commit is contained in:
Kaz Saita(WSL2) 2024-02-12 12:17:22 +09:00
parent 92892f3cf9
commit ffb981b854
3 changed files with 4 additions and 6 deletions

View file

@ -10,6 +10,7 @@ const config: QuartzConfig = {
provider: "google", provider: "google",
tagId: "G-JVXFC0DCRE", tagId: "G-JVXFC0DCRE",
}, },
locale: "ja-JP",
baseUrl: "kinoshita-lab.github.io/public_notes", baseUrl: "kinoshita-lab.github.io/public_notes",
ignorePatterns: ["private", "templates", ".obsidian", "obsidian_templates_"], ignorePatterns: ["private", "templates", ".obsidian", "obsidian_templates_"],
defaultDateType: "modified", defaultDateType: "modified",

View file

@ -24,6 +24,7 @@ export default ((opts?: Partial<ContentMetaOptions>) => {
if (text) { if (text) {
const segments: string[] = [] const segments: string[] = []
segments.push("Last updated: ")
if (fileData.dates) { if (fileData.dates) {
segments.push(formatDate(getDate(cfg, fileData)!, cfg.locale)) segments.push(formatDate(getDate(cfg, fileData)!, cfg.locale))

View file

@ -18,12 +18,8 @@ export function getDate(cfg: GlobalConfiguration, data: QuartzPluginData): Date
return data.dates?.[cfg.defaultDateType] return data.dates?.[cfg.defaultDateType]
} }
export function formatDate(d: Date, locale: ValidLocale = "en-US"): string { export function formatDate(d: Date, locale: ValidLocale = "sv-SE"): string {
return d.toLocaleDateString(locale, { return d.toLocaleDateString(locale)
year: "numeric",
month: "short",
day: "2-digit",
})
} }
export function Date({ date, locale }: Props) { export function Date({ date, locale }: Props) {