* Create a LocalDateTimeValue from an ISO datetime string. * Format: YYYY-MM-DDTHH:MM:SS.nnnnnnnnn
(iso: string)
| 524 | * Format: YYYY-MM-DDTHH:MM:SS.nnnnnnnnn |
| 525 | */ |
| 526 | public static fromString(iso: string): LocalDateTimeValue | null { |
| 527 | const match = iso.match(/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,9}))?$/); |
| 528 | if (!match || !match[1] || !match[2] || !match[3] || !match[4] || !match[5] || !match[6]) |
| 529 | return null; |
| 530 | |
| 531 | const year = parseInt(match[1], 10); |
| 532 | const month = parseInt(match[2], 10); |
| 533 | const day = parseInt(match[3], 10); |
| 534 | const hour = parseInt(match[4], 10); |
| 535 | const minute = parseInt(match[5], 10); |
| 536 | const second = parseInt(match[6], 10); |
| 537 | |
| 538 | let nanosecond = 0; |
| 539 | if (match[7]) { |
| 540 | const frac = match[7].padEnd(9, "0"); |
| 541 | nanosecond = parseInt(frac, 10); |
| 542 | } |
| 543 | |
| 544 | return new LocalDateTimeValue(year, month, day, hour, minute, second, nanosecond); |
| 545 | } |
| 546 | |
| 547 | /** |
| 548 | * Create a LocalDateTimeValue from a map of components. |
nothing calls this directly
no outgoing calls
no test coverage detected