feat: Refactor blog components and add pagination

This commit is contained in:
Wini_Fy
2026-02-03 17:05:09 +07:00
parent bf652a64b6
commit 29cc0bf2cd
27 changed files with 2051 additions and 429 deletions

21
utils/date.ts Normal file
View File

@@ -0,0 +1,21 @@
/**
* Format a date to `20 March 2025` style.
*
* Accepts:
* - ISO string: "2025-03-20T07:59:53.219Z"
* - "2025-03-20" or other Dateparsable strings
* - Date instance
*/
export function formatLongDate(input: string | Date): string {
if (!input) return "";
const date = input instanceof Date ? input : new Date(input);
if (Number.isNaN(date.getTime())) return "";
return date.toLocaleDateString("en-GB", {
day: "numeric",
month: "long",
year: "numeric",
});
}