Fix RSS time filters and add draggable grid layout
Normalize pub_date to ISO 8601 on insert so SQLite datetime comparisons work correctly. Migrate existing RFC 2822 dates. Change 1h filter to 12h. Add react-grid-layout with persistent drag/resize and reset button. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
18
lib/db.ts
18
lib/db.ts
@@ -80,5 +80,23 @@ export async function getDb() {
|
||||
);
|
||||
}
|
||||
|
||||
// Migrate existing non-ISO pub_date values to ISO 8601
|
||||
try {
|
||||
const rows = await db.all(
|
||||
"SELECT id, pub_date FROM rss_items WHERE pub_date IS NOT NULL AND pub_date NOT LIKE '____-__-__T%'"
|
||||
);
|
||||
for (const row of rows) {
|
||||
const d = new Date(row.pub_date);
|
||||
if (!isNaN(d.getTime())) {
|
||||
await db.run('UPDATE rss_items SET pub_date = ? WHERE id = ?', d.toISOString(), row.id);
|
||||
}
|
||||
}
|
||||
if (rows.length > 0) {
|
||||
console.log(`Migrated ${rows.length} rss_items pub_date values to ISO 8601`);
|
||||
}
|
||||
} catch (e) {
|
||||
// Table may not have data yet, ignore
|
||||
}
|
||||
|
||||
return db;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user