* Create a LocalTimeValue from an ISO time string (HH:MM:SS.nnnnnnnnn).
(iso: string)
| 210 | * Create a LocalTimeValue from an ISO time string (HH:MM:SS.nnnnnnnnn). |
| 211 | */ |
| 212 | public static fromString(iso: string): LocalTimeValue | null { |
| 213 | // Match time format: HH:MM:SS or HH:MM:SS.fractional |
| 214 | const match = iso.match(/^(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,9}))?$/); |
| 215 | if (!match || !match[1] || !match[2] || !match[3]) return null; |
| 216 | |
| 217 | const hour = parseInt(match[1], 10); |
| 218 | const minute = parseInt(match[2], 10); |
| 219 | const second = parseInt(match[3], 10); |
| 220 | |
| 221 | // Parse fractional seconds as nanoseconds |
| 222 | let nanosecond = 0; |
| 223 | if (match[4]) { |
| 224 | // Pad to 9 digits |
| 225 | const frac = match[4].padEnd(9, "0"); |
| 226 | nanosecond = parseInt(frac, 10); |
| 227 | } |
| 228 | |
| 229 | return new LocalTimeValue(hour, minute, second, nanosecond); |
| 230 | } |
| 231 | |
| 232 | /** |
| 233 | * Create a LocalTimeValue from a map of components. |
nothing calls this directly
no outgoing calls
no test coverage detected