feat: add image module
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
import type { BlogParsedContent, StoryParsedContent } from "./types";
|
||||
import readingTime from "reading-time";
|
||||
import dayjs from "dayjs";
|
||||
import utc from "dayjs/plugin/utc.js";
|
||||
|
||||
dayjs.extend(utc);
|
||||
|
||||
function countWords(str: string) {
|
||||
let words = 0;
|
||||
@@ -28,3 +32,8 @@ export function calcReadingTime(doc: BlogParsedContent | StoryParsedContent) {
|
||||
let body: string[] = search(doc.body);
|
||||
return readingTime(body.join(" "));
|
||||
}
|
||||
|
||||
export function getPrettyDate(doc: BlogParsedContent | StoryParsedContent) {
|
||||
const date = dayjs(doc.date).utc();
|
||||
return date.format("DD MMM YYYY");
|
||||
}
|
Reference in New Issue
Block a user