1 | import { Time } from './datetime';
|
2 | /**
|
3 | * General date-related utilities.
|
4 | * Also handles several incompatibilities between JavaScript and Python
|
5 | *
|
6 | */
|
7 | export declare namespace dateutil {
|
8 | const MONTH_DAYS: number[];
|
9 | /**
|
10 | * Number of milliseconds of one day
|
11 | */
|
12 | const ONE_DAY: number;
|
13 | /**
|
14 | * @see: <http://docs.python.org/library/datetime.html#datetime.MAXYEAR>
|
15 | */
|
16 | const MAXYEAR = 9999;
|
17 | /**
|
18 | * Python uses 1-Jan-1 as the base for calculating ordinals but we don't
|
19 | * want to confuse the JS engine with milliseconds > Number.MAX_NUMBER,
|
20 | * therefore we use 1-Jan-1970 instead
|
21 | */
|
22 | const ORDINAL_BASE: Date;
|
23 | /**
|
24 | * Python: MO-SU: 0 - 6
|
25 | * JS: SU-SAT 0 - 6
|
26 | */
|
27 | const PY_WEEKDAYS: number[];
|
28 | /**
|
29 | * py_date.timetuple()[7]
|
30 | */
|
31 | const getYearDay: (date: Date) => number;
|
32 | const isLeapYear: (year: number) => boolean;
|
33 | const isDate: (value: any) => value is Date;
|
34 | const isValidDate: (value: any) => value is Date;
|
35 | /**
|
36 | * @return {Number} the date's timezone offset in ms
|
37 | */
|
38 | const tzOffset: (date: Date) => number;
|
39 | /**
|
40 | * @see: <http://www.mcfedries.com/JavaScript/DaysBetween.asp>
|
41 | */
|
42 | const daysBetween: (date1: Date, date2: Date) => number;
|
43 | /**
|
44 | * @see: <http://docs.python.org/library/datetime.html#datetime.date.toordinal>
|
45 | */
|
46 | const toOrdinal: (date: Date) => number;
|
47 | /**
|
48 | * @see - <http://docs.python.org/library/datetime.html#datetime.date.fromordinal>
|
49 | */
|
50 | const fromOrdinal: (ordinal: number) => Date;
|
51 | const getMonthDays: (date: Date) => number;
|
52 | /**
|
53 | * @return {Number} python-like weekday
|
54 | */
|
55 | const getWeekday: (date: Date) => number;
|
56 | /**
|
57 | * @see: <http://docs.python.org/library/calendar.html#calendar.monthrange>
|
58 | */
|
59 | const monthRange: (year: number, month: number) => number[];
|
60 | /**
|
61 | * @see: <http://docs.python.org/library/datetime.html#datetime.datetime.combine>
|
62 | */
|
63 | const combine: (date: Date, time: Date | Time) => Date;
|
64 | const clone: (date: Date | Time) => Date;
|
65 | const cloneDates: (dates: Date[] | Time[]) => Date[];
|
66 | /**
|
67 | * Sorts an array of Date or dateutil.Time objects
|
68 | */
|
69 | const sort: <T extends Pick<Date, "getTime">>(dates: T[]) => void;
|
70 | const timeToUntilString: (time: number, utc?: boolean) => string;
|
71 | const untilStringToDate: (until: string) => Date;
|
72 | }
|
73 | export default dateutil;
|
74 | //# sourceMappingURL=dateutil.d.ts.map |
\ | No newline at end of file |