diff options
Diffstat (limited to 'src/helpers.ts')
-rw-r--r-- | src/helpers.ts | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/helpers.ts b/src/helpers.ts index cfebf394f..1983cee9b 100644 --- a/src/helpers.ts +++ b/src/helpers.ts @@ -140,6 +140,17 @@ export function extractTalerStamp(stamp: string): Timestamp | undefined { } /** + * Extract a timestamp from a Taler timestamp string. + */ +export function extractTalerStampOrThrow(stamp: string): Timestamp { + const r = extractTalerStamp(stamp); + if (!r) { + throw Error("invalid time stamp"); + } + return r; +} + +/** * Check if a timestamp is in the right format. */ export function timestampCheck(stamp: string): boolean { |