Fix date and read time on Blog Posts
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { Database } from 'bun:sqlite';
|
||||
import path from 'path';
|
||||
import { calculateReadTime } from '../frontend/utils';
|
||||
|
||||
/**
|
||||
* Singleton database connection class for managing blog posts and tags
|
||||
@@ -101,7 +102,7 @@ class DatabaseConnection {
|
||||
filePath ? String(filePath) : null,
|
||||
title ? String(title) : null,
|
||||
date ? (date instanceof Date ? date.toISOString().split('T')[0] : String(date)) : null,
|
||||
readingTime ? String(readingTime) : null,
|
||||
readingTime ? String(readingTime) : calculateReadTime(content),
|
||||
excerpt ? String(excerpt) : null,
|
||||
content ? String(content) : null
|
||||
];
|
||||
@@ -269,15 +270,7 @@ class DatabaseConnection {
|
||||
|
||||
// Add tags to each post and clean up paths
|
||||
return posts.map(post => {
|
||||
const basePost = post satisfies {
|
||||
id: number,
|
||||
path: string,
|
||||
title: string,
|
||||
date: string,
|
||||
readingTime: string,
|
||||
summary: string,
|
||||
content: string
|
||||
};
|
||||
const basePost = { ...post, readingTime: post.reading_time}
|
||||
|
||||
return {
|
||||
...basePost,
|
||||
|
||||
Reference in New Issue
Block a user