aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2023-02-20 13:23:01 -0300
committerSebastian <sebasjm@gmail.com>2023-02-20 13:23:01 -0300
commit26aca142fef3ec92d80dadc6ff741d070737fb08 (patch)
treebc97a00e70a4c3ba983314e117a67c60125f6645
parent68f3c3b4470244270ec9be074d10441f56880f05 (diff)
fix: protocol min was returning never
-rw-r--r--packages/taler-util/src/time.ts11
1 files changed, 10 insertions, 1 deletions
diff --git a/packages/taler-util/src/time.ts b/packages/taler-util/src/time.ts
index 6ffabd495..21963ee6b 100644
--- a/packages/taler-util/src/time.ts
+++ b/packages/taler-util/src/time.ts
@@ -64,10 +64,19 @@ export namespace TalerProtocolTimestamp {
return { t_s: t2.t_s };
}
if (t2.t_s === "never") {
- return { t_s: t2.t_s };
+ return { t_s: t1.t_s };
}
return { t_s: Math.min(t1.t_s, t2.t_s) };
}
+ export function max(
+ t1: TalerProtocolTimestamp,
+ t2: TalerProtocolTimestamp,
+ ): TalerProtocolTimestamp {
+ if (t1.t_s === "never" || t2.t_s === "never") {
+ return { t_s: "never" };
+ }
+ return { t_s: Math.max(t1.t_s, t2.t_s) };
+ }
}
export interface Duration {