From 9e6a55bb547158b9e0309d6936044497b9a4b358 Mon Sep 17 00:00:00 2001 From: Fenris Wolf Date: Sat, 26 Oct 2024 13:45:11 +0200 Subject: [PATCH] [upd] plankton --- lib/plankton/plankton.d.ts | 18 ++++++++- lib/plankton/plankton.js | 75 ++++++++++++++++++++++++++++++++++++-- 2 files changed, 89 insertions(+), 4 deletions(-) diff --git a/lib/plankton/plankton.d.ts b/lib/plankton/plankton.d.ts index a25b58e..ade56fc 100644 --- a/lib/plankton/plankton.d.ts +++ b/lib/plankton/plankton.d.ts @@ -3098,6 +3098,10 @@ declare namespace lib_plankton.pit { type type_pit = int; } declare namespace lib_plankton.pit { + /** + * @todo complete + */ + function timezone_name_to_timezone_shift(timezone_name: string): int; /** */ function date_object_get_week_of_year(date: Date): int; @@ -3111,7 +3115,7 @@ declare namespace lib_plankton.pit { */ function to_date_object(pit: type_pit): Date; /** - * @todo timezone + * @todo test */ function to_datetime(pit: type_pit, options?: { timezone_shift?: int; @@ -3151,6 +3155,18 @@ declare namespace lib_plankton.pit { function to_ywd(pit: type_pit, options?: { timezone_shift?: int; }): type_ywd; + /** + * computes the point in time for switching to central european summer time + * + * @todo write tests + */ + function cest_switch_on(year: int): type_pit; + /** + * computes the point in time for switching away from central european summer time + * + * @todo write tests + */ + function cest_switch_off(year: int): type_pit; } declare namespace lib_plankton.ical { /** diff --git a/lib/plankton/plankton.js b/lib/plankton/plankton.js index fafcae0..3ccab96 100644 --- a/lib/plankton/plankton.js +++ b/lib/plankton/plankton.js @@ -4090,7 +4090,7 @@ var lib_plankton; return { "reports": [ { - "incident": "no valid apaptions", + "incident": "no valid adaptions", "details": { "sub_adaptions": sub_adaptions, } @@ -6076,7 +6076,7 @@ var lib_plankton; /** */ function postgresql_wrap_name(name) { - return ("" + name + ""); + return ("\"" + name + "\""); } database.postgresql_wrap_name = postgresql_wrap_name; /** @@ -10614,6 +10614,23 @@ var lib_plankton; (function (lib_plankton) { var pit; (function (pit_1) { + /** + * @todo complete + */ + function timezone_name_to_timezone_shift(timezone_name) { + const map = { + "UTC": 0, + "CET": +1, + "CEST": +2, + }; + if (!(timezone_name in map)) { + throw (new Error("unhandled timezone: " + timezone_name)); + } + else { + return map[timezone_name]; + } + } + pit_1.timezone_name_to_timezone_shift = timezone_name_to_timezone_shift; /** */ function date_object_get_week_of_year(date) { @@ -10659,7 +10676,7 @@ var lib_plankton; return Math.round(date_object.getTime() / 1000); } /** - * @todo timezone + * @todo test */ function to_datetime(pit, options = {}) { options = Object.assign({ @@ -10917,6 +10934,58 @@ var lib_plankton; ]); } pit_1.to_ywd = to_ywd; + /** + * computes the point in time for switching to central european summer time + * + * @todo write tests + */ + function cest_switch_on(year) { + return lib_plankton.call.convey(year, [ + (x) => ({ + "timezone_shift": 0, + "date": { + "year": x, + "month": 4, + "day": 1, + }, + "time": { + "hour": 2, + "minute": 0, + "second": 0 + }, + }), + from_datetime, + trunc_week, + x => shift_day(x, -1), + ]); + } + pit_1.cest_switch_on = cest_switch_on; + /** + * computes the point in time for switching away from central european summer time + * + * @todo write tests + */ + function cest_switch_off(year) { + return lib_plankton.call.convey(year, [ + (x) => ({ + "timezone_shift": 0, + "date": { + "year": x, + "month": 11, + "day": 1, + }, + "time": { + "hour": 1, + "minute": 0, + "second": 0 + }, + }), + from_datetime, + trunc_week, + x => shift_day(x, -1), + ]); + } + pit_1.cest_switch_off = cest_switch_off; })(pit = lib_plankton.pit || (lib_plankton.pit = {})); })(lib_plankton || (lib_plankton = {})); /*