[upd] plankton

This commit is contained in:
Fenris Wolf 2024-10-26 13:45:11 +02:00
parent 2c6db357f0
commit 9e6a55bb54
2 changed files with 89 additions and 4 deletions

View file

@ -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 {
/**

View file

@ -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 = {}));
/*