From dd12b49f4db71b82cbf8e7cf72e1a0e593999a6a Mon Sep 17 00:00:00 2001 From: "Jade (Rose) Rowland" Date: Tue, 13 Aug 2024 15:00:16 -0400 Subject: [PATCH] withduration --- packages/core/timespan.mjs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/core/timespan.mjs b/packages/core/timespan.mjs index 07875a5a1..81db8aac0 100644 --- a/packages/core/timespan.mjs +++ b/packages/core/timespan.mjs @@ -65,6 +65,10 @@ export class TimeSpan { // Applies given function to the end time of the timespan""" return new TimeSpan(func_time(this.begin), this.end); } + withDuration(func_time) { + const duration = this.end.sub(this.begin) + return new TimeSpan(this.begin, this.begin.add(func_time(duration))) + } withCycle(func_time) { // Like withTime, but time is relative to relative to the cycle (i.e. the