export function newExpiryDate( month: string | undefined, year: string | undefined ): Date | null { if (!month || !year) return null; if (isNaN(+month)) return null; if (isNaN(+year)) return null; if (month.length === 0 || month.length > 2) return null; if (year.length !== 2) return null; const dateString = `20${year}-${month.padStart(2, '0')}-01`; return new Date(dateString); }