feat: add defaultDateType config
This commit is contained in:
		@@ -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)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user