{"version":3,"file":"_isFormatDate.mjs","names":[],"sources":["../../src/internal/_isFormatDate.ts"],"sourcesContent":["/**\n * Checks four-digit year, month and day syntax and Gregorian month length.\n *\n * The numeric year is used directly, including year zero; Date parsing and its\n * local-time normalization do not determine validity.\n *\n * @evidence contracts/common.md#principled-implementation Captured ranges establish month and positive day bounds before indexing the month-length table. The divisible-by-400 or divisible-by-4-but-not-100 rule adds the February leap day, so syntactically valid impossible dates fail.\n * @evidence contracts/common.md#clear-and-simple-design The private syntax expression and month-length table separate lexical ranges from the one calendar calculation that syntax cannot establish.\n * @evidence contracts/common.md#prohibited-implementation-shortcuts The table and divisibility rules represent the calendar uniformly; no dates or consumers receive special outcomes.\n * @evidence contracts/common.md#meaningful-documentation The doc states the four-digit year, month and day syntax and the Gregorian month length, that year zero is accepted and that Date parsing does not decide validity.\n */\nexport const _isFormatDate = (str: string): boolean => {\n  const match: RegExpExecArray | null = PATTERN.exec(str);\n  if (match === null) return false;\n  const year: number = Number(match[1]);\n  const month: number = Number(match[2]);\n  const day: number = Number(match[3]);\n  const maximum: number =\n    DAYS[month - 1]! +\n    (month === 2 && (year % 400 === 0 || (year % 4 === 0 && year % 100 !== 0))\n      ? 1\n      : 0);\n  return day <= maximum;\n};\n\nconst PATTERN = /^([0-9]{4})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/;\nconst DAYS = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] as const;\n"],"mappings":";;;;;;;;;;;;AAWA,MAAa,iBAAiB,QAAyB;CACrD,MAAM,QAAgC,QAAQ,KAAK,GAAG;CACtD,IAAI,UAAU,MAAM,OAAO;CAC3B,MAAM,OAAe,OAAO,MAAM,EAAE;CACpC,MAAM,QAAgB,OAAO,MAAM,EAAE;CAOrC,OANoB,OAAO,MAAM,EAMxB,KAJP,KAAK,QAAQ,MACZ,UAAU,MAAM,OAAO,QAAQ,KAAM,OAAO,MAAM,KAAK,OAAO,QAAQ,KACnE,IACA;AAER;AAEA,MAAM,UAAU;AAChB,MAAM,OAAO;CAAC;CAAI;CAAI;CAAI;CAAI;CAAI;CAAI;CAAI;CAAI;CAAI;CAAI;CAAI;AAAE"}