MCPcopy Create free account
hub / github.com/chhoumann/quickadd / parseDateSnapSegment

Function parseDateSnapSegment

src/utils/dateModifiers.ts:73–81  ·  view source on GitHub ↗
(segment: string)

Source from the content-addressed store, hash-verified

71 * key IS a snap key but the unit is unknown.
72 */
73export 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

Callers 2

replaceDateInStringFunction · 0.90

Calls 2

parsePipeKeyValueFunction · 0.90
normalizeDateUnitFunction · 0.85

Tested by

no test coverage detected