IF Commons GitHub

governance/time

Written to: 1 requirement: 1 proved, 0 partly, 0 failing, 0 with no test recorded. 0002-grc-governance FR-009

Durations and instants: ISO 8601 durations (P1D, PT1H, P1Y) as exact lengths, and the sum of an instant and a duration. A year is 365 days and a month 30, so that a cadence is the same on every runtime and in every month. Pure: nothing here reads the clock.

import { parseDuration } from "./time.ts";
parseDuration("P1W"); // { kind: "ok", value: 604800000 }

Source: commons/grc/src/governance/time.ts

2 of 6 exports are imported by a test of the run. A test that imports an export may not call it or check what it returns.

governance.parseDurationfunctionno test imports it
function parseDuration(text: string): Result<number, string>

The length in milliseconds of an ISO 8601 duration, or why the text is not one.

governance.instantMsfunctionno test imports it
function instantMs(text: string): number | undefined

An instant as milliseconds since the epoch, or undefined where the text is not an ISO 8601 instant with a zone.

governance.addDurationfunctionno test imports it
function addDuration(instant: string, duration: string): Result<string, string>

The instant a duration after instant, as an ISO 8601 instant in UTC.

parseDurationfunction
function parseDuration(text: string): Result<number, string>

The length in milliseconds of an ISO 8601 duration, or why the text is not one.

Imported by 9 tests of the run (9 passed, 0 failed): the library's results

instantMsfunctionno test imports it
function instantMs(text: string): number | undefined

An instant as milliseconds since the epoch, or undefined where the text is not an ISO 8601 instant with a zone.

addDurationfunction
function addDuration(instant: string, duration: string): Result<string, string>

The instant a duration after instant, as an ISO 8601 instant in UTC.

Imported by 9 tests of the run (9 passed, 0 failed): the library's results

Titles, headings, exports, tables, columns and requirements. Esc closes.