(yearStr: string)
| 262 | * Example (when current year is 2025): 00-74 → 2000-2074, 75-99 → 1975-1999 |
| 263 | */ |
| 264 | export function parseYear(yearStr: string): number | undefined { |
| 265 | const formats = ['yy', 'yyyy']; |
| 266 | for (const fmt of formats) { |
| 267 | const parsed = parse(yearStr.trim(), fmt, new Date()); |
| 268 | if (isValid(parsed)) { |
| 269 | return parsed.getFullYear(); |
| 270 | } |
| 271 | } |
| 272 | return undefined; |
| 273 | } |
no test coverage detected
searching dependent graphs…