mirror of
https://github.com/alrayyes/wiki.git
synced 2025-05-22 07:42:12 +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,15 +1,16 @@
|
|||
import { formatDate } from "./Date"
|
||||
import { formatDate, getDate } from "./Date"
|
||||
import { QuartzComponentConstructor, QuartzComponentProps } from "./types"
|
||||
import readingTime from "reading-time"
|
||||
|
||||
export default (() => {
|
||||
function ContentMetadata({ fileData }: QuartzComponentProps) {
|
||||
function ContentMetadata({ cfg, fileData }: QuartzComponentProps) {
|
||||
const text = fileData.text
|
||||
if (text) {
|
||||
const segments: string[] = []
|
||||
const { text: timeTaken, words: _words } = readingTime(text)
|
||||
if (fileData.dates?.modified) {
|
||||
segments.push(formatDate(fileData.dates.modified))
|
||||
|
||||
if (fileData.dates) {
|
||||
segments.push(formatDate(getDate(cfg, fileData)!))
|
||||
}
|
||||
|
||||
segments.push(timeTaken)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue