fix: refactor process content
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user