fix: treat HTML nbsp as whitespace in reading time
All checks were successful
CodeAnt AI Review - Stage 1 / codeant-review (pull_request) Successful in 2m53s

This commit is contained in:
WDI-Ideas
2026-03-30 03:24:17 +05:30
parent 2a958262cc
commit 392cc78933

View File

@@ -2,7 +2,7 @@ export const getReadingTime = (text: string): string => {
if (!text) return "0 min read"; if (!text) return "0 min read";
// Remove HTML tags if present // Remove HTML tags if present
const cleanText = text.replace(/<[^>]+>/g, ""); const cleanText = text.replace(/<[^>]+>/g, "").replace(/&nbsp;/gi, " ");
if (!cleanText.trim()) return "0 min read"; if (!cleanText.trim()) return "0 min read";
// Count words // Count words