MCPcopy Create free account
hub / github.com/adobe/react-spectrum / parseDurationGroup

Function parseDurationGroup

packages/@internationalized/date/src/string.ts:268–278  ·  view source on GitHub ↗
(group: string | undefined, isNegative: boolean)

Source from the content-addressed store, hash-verified

266 }
267
268 const parseDurationGroup = (group: string | undefined, isNegative: boolean): number => {
269 if (!group) {
270 return 0;
271 }
272 try {
273 const sign = isNegative ? -1 : 1;
274 return sign * Number(group.replace(',', '.'));
275 } catch {
276 throw new Error(`Invalid ISO 8601 Duration string: ${value}`);
277 }
278 };
279
280 const isNegative = !!match.groups?.negative;
281

Callers 1

parseDurationFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected