(segment: string)
| 71 | * key IS a snap key but the unit is unknown. |
| 72 | */ |
| 73 | export function parseDateSnapSegment(segment: string): DateSnap | null { |
| 74 | const keyed = parsePipeKeyValue(segment); |
| 75 | if (!keyed) return null; |
| 76 | if (keyed.key === "startof") |
| 77 | return { boundary: "start", unit: normalizeDateUnit(keyed.value) }; |
| 78 | if (keyed.key === "endof") |
| 79 | return { boundary: "end", unit: normalizeDateUnit(keyed.value) }; |
| 80 | return null; |
| 81 | } |
| 82 | |
| 83 | /** |
| 84 | * Applies a snap to a moment IN PLACE (moment mutates) and returns it. Callers |
no test coverage detected