(text: string, at: number)
| 546 | |
| 547 | /** The two-digit number at `at`, or `-1` when those characters are not digits. */ |
| 548 | const twoDigitsAt = (text: string, at: number): number => { |
| 549 | const tens = text.charCodeAt(at) - 48 |
| 550 | const units = text.charCodeAt(at + 1) - 48 |
| 551 | return tens >= 0 && tens <= 9 && units >= 0 && units <= 9 ? tens * 10 + units : -1 |
| 552 | } |
| 553 | |
| 554 | /** Parses `[-]YYYY-MM-DD`, with as many year digits as the caller likes. */ |
| 555 | const parseDate = (text: string): number => { |