[upd] plankton

This commit is contained in:
Fenris Wolf 2024-09-26 16:47:19 +02:00
parent 589136cc35
commit 32ec509064
3 changed files with 350 additions and 1149 deletions

View file

@ -6,29 +6,6 @@ type int = number;
* @author fenris * @author fenris
*/ */
type float = number; type float = number;
/**
* @author fenris
*/
type type_date = {
year: int;
month: int;
day: int;
};
/**
* @author fenris
*/
type type_time = {
hour: int;
minute: int;
second: int;
};
/**
* @author fenris
*/
type type_datetimeobject = {
date: type_date;
time: type_time;
};
declare var process: any; declare var process: any;
declare var require: any; declare var require: any;
declare class Buffer { declare class Buffer {
@ -2942,38 +2919,15 @@ declare namespace lib_plankton.session {
clear?: boolean; clear?: boolean;
}): Promise<void>; }): Promise<void>;
} }
declare module lib_et { declare namespace lib_plankton.pit {
/** /**
* @desc type of extended timestamp
* @author fenris
*/ */
type type_et = { type type_date = {
era: int;
stamp: int;
};
/**
* @desc type of UNIX timestamp
* @author fenris
*/
type type_timestamp = int;
/**
* @desc type of Javascript Date object
* @author fenris
*/
type type_jsdate = Date;
/**
* @author fenris
*/
type type_components = {
year: int; year: int;
month: int; month: int;
day: int; day: int;
hour: int;
minute: int;
second: int;
}; };
/** /**
* @author fenris
*/ */
type type_ywd = { type type_ywd = {
year: int; year: int;
@ -2981,310 +2935,78 @@ declare module lib_et {
day: int; day: int;
}; };
/** /**
* @author fenris
*/ */
function part(et1: type_et, et2: type_et): type_et; type type_time = {
/**
* @desc less
* @author fenris
*/
function before(reference: type_et, et: type_et): boolean;
/**
* @desc greater
* @author fenris
*/
function after(reference: type_et, et: type_et): boolean;
/**
* @author fenris
*/
function between(begin: type_et, end: type_et, et: type_et): boolean;
/**
* @author fenris
*/
function intersect(begin1: type_et, end1: type_et, begin2: type_et, end2: type_et): boolean;
/**
* @author fenris
*/
function move(base: type_et, span: type_et): type_et;
/**
* @desc currified version of "move"
* @author fenris
*/
function move_(span: type_et): (base: type_et) => type_et;
/**
* @author fenris
*/
function from_timestamp(timestamp: type_timestamp): type_et;
/**
* @author fenris
*/
function to_timestamp(et: type_et): type_timestamp;
/**
* @author fenris
*/
function from_jsdate(jsdate: type_jsdate): type_et;
/**
* @author fenris
*/
function to_jsdate(et: type_et): type_jsdate;
/**
* @author fenris
*/
function from_components(components: type_components): type_et;
/**
* @author fenris
*/
function to_components(et: type_et): type_components;
/**
* @author fenris
*/
function now(): type_et;
/**
* @author fenris
*/
function to_string(et: type_et): string;
/**
* @author fenris
*/
function to_string_ywd(et: type_et): string;
/**
* @desc retrieve week of year
* @author fenris
*/
function get_woy(et: type_et): int;
/**
* @desc retrieve day of week
* @author fenris
*/
function get_dow(et: type_et): int;
/**
* @author fenris
*/
function trunc_minute(et?: type_et): type_et;
/**
* @author fenris
*/
function trunc_hour(et?: type_et): type_et;
/**
* @author fenris
*/
function trunc_day(et?: type_et): type_et;
/**
* @author fenris
*/
function trunc_month(et?: type_et): type_et;
/**
* @author fenris
*/
function trunc_year(et?: type_et): type_et;
/**
* @author fenris
*/
function trunc_week(et?: type_et): type_et;
/**
* @author fenris
*/
function span_second(seconds?: int): type_et;
/**
* @author fenris
*/
function span_minute(minutes?: int): type_et;
/**
* @author fenris
*/
function span_hour(hours?: int): type_et;
/**
* @author fenris
*/
function span_day(days?: int): type_et;
/**
* @author fenris
*/
function span_week(weeks?: int): type_et;
/**
* @author fenris
*/
function span_year(years?: int): type_et;
}
declare module lib_et {
/**
* @author fenris
*/
class class_et {
/**
* @author fenris
*/
protected subject: type_et;
/**
* @author fenris
*/
constructor(subject: type_et);
/**
* @author fenris
*/
move(et: class_et): class_et;
/**
* @author fenris
*/
before(et: class_et): boolean;
/**
* @author fenris
*/
after(et: class_et): boolean;
/**
* @author fenris
*/
between(et1: class_et, et2: class_et): boolean;
/**
* @author fenris
*/
trunc_minute(): class_et;
/**
* @author fenris
*/
trunc_hour(): class_et;
/**
* @author fenris
*/
trunc_day(): class_et;
/**
* @author fenris
*/
trunc_month(): class_et;
/**
* @author fenris
*/
trunc_year(): class_et;
/**
* @author fenris
*/
trunc_week(): class_et;
/**
* @author fenris
*/
static now(): class_et;
/**
* @author fenris
*/
static span_second(count?: int): class_et;
/**
* @author fenris
*/
static span_minute(count?: int): class_et;
/**
* @author fenris
*/
static span_hour(count?: int): class_et;
/**
* @author fenris
*/
static span_day(count?: int): class_et;
/**
* @author fenris
*/
static span_week(count?: int): class_et;
/**
* @author fenris
*/
static span_year(count?: int): class_et;
/**
* @author fenris
*/
static from_timestamp(timestamp: type_timestamp): class_et;
/**
* @author fenris
*/
to_timestamp(): type_timestamp;
/**
* @author fenris
*/
static from_jsdate(jsdate: type_jsdate): class_et;
/**
* @author fenris
*/
to_jsdate(): type_jsdate;
/**
* @author fenris
*/
static from_components(components: type_components): class_et;
/**
* @author fenris
*/
to_components(): type_components;
/**
* @author fenris
*/
get_woy(): int;
/**
* @author fenris
*/
get_dow(): int;
/**
* @author fenris
*/
to_string(): string;
}
}
declare var global_config: any;
/**
* @author neuc
*/
declare namespace lib_plankton.date {
/**
* @author neu3no, fenris
*/
function set_days(day_names: Array<string>): void;
/**
* @author neu3no, fenris
*/
function set_months(month_names: Array<string>): void;
/**
* @desc week of year
* @param {Date} date
* @return {int}
* @author fenris
*/
function get_week(date: Date): int;
/**
* @author neu3no, fenris
*/
function set_currentDate(date: Date): void;
/**
* @author neu3no, fenris
*/
function parse(format: string, date?: Date): string;
/**
* @author neu3no, fenris
*/
function locale_date(date?: Date, ignore_error?: boolean): string;
/**
*/
type type_unixtimestamp = int;
/**
*/
type type_components = {
timezone_offset: int;
year: int;
month: int;
day: int;
hour: int; hour: int;
minute: int; minute: int;
second: int; second: int;
}; };
/** /**
*/ */
function now(): type_unixtimestamp; type type_datetime = {
timezone_shift: int;
date: type_date;
time: (null | type_time);
};
/** /**
*/ */
function from_components(components: type_components): type_unixtimestamp; type type_pit = int;
/** }
*/ declare namespace lib_plankton.pit {
function to_components(unixtimestamp: type_unixtimestamp): type_components; /**
/** */
*/ function date_object_get_week_of_year(date: Date): int;
function get_timestamp_from_year_and_week_and_day(year: int, week: int, day: int): type_unixtimestamp; /**
*/
function to_unix_timestamp(pit: type_pit): int;
/**
*/
function from_unix_timestamp(unix_timestamp: int): type_pit;
/**
*/
function to_date_object(pit: type_pit): Date;
/**
* @todo timezone
*/
function to_datetime(pit: type_pit, options?: {
timezone_shift?: int;
}): type_datetime;
/**
*/
function from_datetime(datetime: type_datetime): type_pit;
/**
*/
function is_before(pit: type_pit, reference: type_pit): boolean;
/**
*/
function is_between(pit: type_pit, reference_left: type_pit, reference_right: type_pit): boolean;
/**
*/
function shift_day(pit: type_pit, increment: int): type_pit;
/**
*/
function shift_week(pit: type_pit, increment: int): type_pit;
/**
*/
function trunc_week(pit: type_pit): type_pit;
/**
*/
function now(): type_pit;
/**
* @param year year according to specified timezone shift
* @param week week according to specified timezone shift
* @return the begin of the week (monday, 00:00)
*/
function from_ywd(ywd: type_ywd, options?: {
timezone_shift?: int;
}): type_pit;
/**
* @todo timezone
*/
function to_ywd(pit: type_pit, options?: {
timezone_shift?: int;
}): type_ywd;
} }
declare var strftime: typeof lib_plankton.date;
declare namespace lib_plankton.ical { declare namespace lib_plankton.ical {
/** /**
*/ */
@ -3436,7 +3158,7 @@ declare namespace lib_plankton.ical {
declare namespace lib_plankton.ical { declare namespace lib_plankton.ical {
/** /**
*/ */
function datetime_to_unixtimestamp(datetime: type_datetime): lib_plankton.date.type_unixtimestamp; function datetime_to_unixtimestamp(datetime: type_datetime): int;
/** /**
* @see https://www.rfc-editor.org/rfc/rfc5545 * @see https://www.rfc-editor.org/rfc/rfc5545
* @see https://icalendar.org/iCalendar-RFC-5545/ * @see https://icalendar.org/iCalendar-RFC-5545/

File diff suppressed because it is too large Load diff

View file

@ -25,6 +25,7 @@ modules="${modules} server"
modules="${modules} args" modules="${modules} args"
modules="${modules} bcrypt" modules="${modules} bcrypt"
modules="${modules} map" modules="${modules} map"
modules="${modules} pit"
modules="${modules} auth" modules="${modules} auth"