diff --git a/source/helpers.ts b/source/helpers.ts index 865a97d..9fb2a85 100644 --- a/source/helpers.ts +++ b/source/helpers.ts @@ -60,7 +60,14 @@ function datetime_from_date_object( }, options ); - const date_ : Date = new Date(date.getTime() + (((options.timezone_shift as int) * (60 * 60)) * 1000)); + const date_ : Date = lib_plankton.call.convey( + date, + [ + (x : Date) => x.getTime(), + (x : int) => (x + (((options.timezone_shift as int) * (60 * 60)) * 1000)), + (x : int) => new Date(x), + ] + ); const iso_string : string = date_.toISOString(); return { "timezone_shift": (options.timezone_shift as int), diff --git a/source/logic.ts b/source/logic.ts index b59d396..3c58a79 100644 --- a/source/logic.ts +++ b/source/logic.ts @@ -244,6 +244,7 @@ async function calendar_gather_events( "headers": {}, "body": null, }; + // TODO: cache? const http_response : lib_plankton.http.type_response = await lib_plankton.http.call( http_request, { @@ -291,6 +292,13 @@ async function calendar_gather_events( .filter( (event) => (event !== null) ) + .filter( + (event) => pit_is_between( + pit_from_datetime(event.begin), + from_pit, + to_pit + ) + ) .map( (event) => ({"calendar_id": calendar_id, "event": event}) )