fix: refactor process content

This commit is contained in:
riefive
2025-11-20 14:16:21 +07:00
parent 3c546e19a6
commit bbdc79f7f5
5 changed files with 388 additions and 114 deletions
+13
View File
@@ -73,3 +73,16 @@ export function formatDateYyyyMmDd(isoDateString: string): string {
const day = String(date.getDate()).padStart(2, '0');
return `${year}-${month}-${day}`;
}
// Function to check if date is invalid (like "0001-01-01T00:00:00Z")
export function isValidDate(dateString: string | null | undefined): boolean {
if (!dateString) return false
// Check for invalid date patterns
if (dateString.startsWith('0001-01-01')) return false
try {
const date = new Date(dateString)
return !isNaN(date.getTime())
} catch {
return false
}
}