mirror of
https://github.com/alrayyes/wiki.git
synced 2025-05-05 16:22:22 +00:00
feat: add defaultDateType config
This commit is contained in:
parent
98d82415dc
commit
c36a9f3fb7
8 changed files with 52 additions and 30 deletions
quartz/components
|
@ -1,7 +1,16 @@
|
|||
import { GlobalConfiguration } from "../cfg"
|
||||
import { QuartzPluginData } from "../plugins/vfile"
|
||||
|
||||
interface Props {
|
||||
date: Date
|
||||
}
|
||||
|
||||
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",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue