@naturalcycles/js-lib 14.86.0 → 14.89.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/datetime/localDate.d.ts +75 -0
- package/dist/datetime/localDate.js +290 -0
- package/dist/datetime/localTime.d.ts +78 -0
- package/dist/datetime/localTime.js +304 -0
- package/dist/decorators/createPromiseDecorator.d.ts +2 -2
- package/dist/decorators/createPromiseDecorator.js +6 -12
- package/dist/index.d.ts +6 -1
- package/dist/index.js +47 -44
- package/dist/string/leven.d.ts +6 -0
- package/dist/string/leven.js +75 -0
- package/dist-esm/datetime/localDate.js +285 -0
- package/dist-esm/datetime/localTime.js +299 -0
- package/dist-esm/decorators/createPromiseDecorator.js +8 -15
- package/dist-esm/index.js +3 -0
- package/dist-esm/string/leven.js +71 -0
- package/dist-esm/vendor/is.js +4 -4
- package/package.json +2 -1
- package/src/__exclude/lazyLocalDate.ts +73 -0
- package/src/datetime/localDate.ts +355 -0
- package/src/datetime/localTime.ts +362 -0
- package/src/decorators/createPromiseDecorator.ts +64 -70
- package/src/index.ts +10 -0
- package/src/string/leven.ts +86 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { Sequence } from '../seq/seq';
|
|
2
|
+
import { IsoDate } from '../types';
|
|
3
|
+
export declare type LocalDateUnit = 'year' | 'month' | 'day';
|
|
4
|
+
export declare type LocalDateConfig = LocalDate | string;
|
|
5
|
+
/**
|
|
6
|
+
* @experimental
|
|
7
|
+
*/
|
|
8
|
+
export declare class LocalDate {
|
|
9
|
+
year: number;
|
|
10
|
+
month: number;
|
|
11
|
+
day: number;
|
|
12
|
+
private constructor();
|
|
13
|
+
static create(year: number, month: number, day: number): LocalDate;
|
|
14
|
+
/**
|
|
15
|
+
* Parses input String into LocalDate.
|
|
16
|
+
* Input can already be a LocalDate - it is returned as-is in that case.
|
|
17
|
+
*/
|
|
18
|
+
static of(d: LocalDateConfig): LocalDate;
|
|
19
|
+
static parseCompact(d: string): LocalDate;
|
|
20
|
+
static fromDate(d: Date): LocalDate;
|
|
21
|
+
static today(): LocalDate;
|
|
22
|
+
static sort(items: LocalDate[], mutate?: boolean, descending?: boolean): LocalDate[];
|
|
23
|
+
static earliestOrUndefined(items: LocalDate[]): LocalDate | undefined;
|
|
24
|
+
static earliest(items: LocalDate[]): LocalDate;
|
|
25
|
+
static latestOrUndefined(items: LocalDate[]): LocalDate | undefined;
|
|
26
|
+
static latest(items: LocalDate[]): LocalDate;
|
|
27
|
+
static range(minIncl: LocalDateConfig, maxExcl: LocalDateConfig, step?: number, stepUnit?: LocalDateUnit): LocalDate[];
|
|
28
|
+
static rangeSeq(minIncl: LocalDateConfig, maxExcl: LocalDateConfig, step?: number, stepUnit?: LocalDateUnit): Sequence<LocalDate>;
|
|
29
|
+
static rangeString(minIncl: LocalDateConfig, maxExcl: LocalDateConfig, step?: number, stepUnit?: LocalDateUnit): IsoDate[];
|
|
30
|
+
static rangeIncl(minIncl: LocalDateConfig, maxIncl: LocalDateConfig, step?: number, stepUnit?: LocalDateUnit): LocalDate[];
|
|
31
|
+
static rangeInclString(minIncl: LocalDateConfig, maxIncl: LocalDateConfig, step?: number, stepUnit?: LocalDateUnit): IsoDate[];
|
|
32
|
+
isSame(d: LocalDateConfig): boolean;
|
|
33
|
+
isBefore(d: LocalDateConfig): boolean;
|
|
34
|
+
isSameOrBefore(d: LocalDateConfig): boolean;
|
|
35
|
+
isAfter(d: LocalDateConfig): boolean;
|
|
36
|
+
isSameOrAfter(d: LocalDateConfig): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Returns 1 if this > d
|
|
39
|
+
* returns 0 if they are equal
|
|
40
|
+
* returns -1 if this < d
|
|
41
|
+
*/
|
|
42
|
+
cmp(d: LocalDateConfig): -1 | 0 | 1;
|
|
43
|
+
/**
|
|
44
|
+
* Same as Math.abs( diff )
|
|
45
|
+
*/
|
|
46
|
+
absDiff(d: LocalDateConfig, unit: LocalDateUnit): number;
|
|
47
|
+
/**
|
|
48
|
+
* Returns the number of **full** units difference (aka `Math.ceil`).
|
|
49
|
+
*
|
|
50
|
+
* a.diff(b) means "a minus b"
|
|
51
|
+
*/
|
|
52
|
+
diff(d: LocalDateConfig, unit: LocalDateUnit): number;
|
|
53
|
+
add(num: number, unit: LocalDateUnit, mutate?: boolean): LocalDate;
|
|
54
|
+
subtract(num: number, unit: LocalDateUnit, mutate?: boolean): LocalDate;
|
|
55
|
+
startOf(unit: LocalDateUnit): LocalDate;
|
|
56
|
+
endOf(unit: LocalDateUnit): LocalDate;
|
|
57
|
+
private getYearDays;
|
|
58
|
+
private getMonthLen;
|
|
59
|
+
private isLeapYear;
|
|
60
|
+
clone(): LocalDate;
|
|
61
|
+
/**
|
|
62
|
+
* Converts LocalDate into instance of Date.
|
|
63
|
+
* Year, month and day will match.
|
|
64
|
+
* Hour, minute, second, ms will be 0.
|
|
65
|
+
* Timezone will match local timezone.
|
|
66
|
+
*/
|
|
67
|
+
toDate(): Date;
|
|
68
|
+
toString(): IsoDate;
|
|
69
|
+
toStringCompact(): string;
|
|
70
|
+
toJSON(): IsoDate;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Shortcut wrapper around `LocalDate.parse` / `LocalDate.today`
|
|
74
|
+
*/
|
|
75
|
+
export declare function localDate(d?: LocalDateConfig): LocalDate;
|
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.localDate = exports.LocalDate = void 0;
|
|
4
|
+
const assert_1 = require("../error/assert");
|
|
5
|
+
const seq_1 = require("../seq/seq");
|
|
6
|
+
const types_1 = require("../types");
|
|
7
|
+
const m31 = new Set([1, 3, 5, 7, 8, 10, 12]);
|
|
8
|
+
/**
|
|
9
|
+
* @experimental
|
|
10
|
+
*/
|
|
11
|
+
class LocalDate {
|
|
12
|
+
constructor(year, month, day) {
|
|
13
|
+
this.year = year;
|
|
14
|
+
this.month = month;
|
|
15
|
+
this.day = day;
|
|
16
|
+
}
|
|
17
|
+
static create(year, month, day) {
|
|
18
|
+
return new LocalDate(year, month, day);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Parses input String into LocalDate.
|
|
22
|
+
* Input can already be a LocalDate - it is returned as-is in that case.
|
|
23
|
+
*/
|
|
24
|
+
static of(d) {
|
|
25
|
+
if (d instanceof LocalDate)
|
|
26
|
+
return d;
|
|
27
|
+
const [year, month, day] = d.slice(0, 10).split('-').map(Number);
|
|
28
|
+
if (!day || !month || (!year && year !== 0)) {
|
|
29
|
+
throw new Error(`Cannot parse "${d}" into LocalDate`);
|
|
30
|
+
}
|
|
31
|
+
return new LocalDate(year, month, day);
|
|
32
|
+
}
|
|
33
|
+
static parseCompact(d) {
|
|
34
|
+
const [year, month, day] = [d.slice(0, 4), d.slice(4, 2), d.slice(6, 2)].map(Number);
|
|
35
|
+
if (!day || !month || (!year && year !== 0)) {
|
|
36
|
+
throw new Error(`Cannot parse "${d}" into LocalDate`);
|
|
37
|
+
}
|
|
38
|
+
return new LocalDate(year, month, day);
|
|
39
|
+
}
|
|
40
|
+
static fromDate(d) {
|
|
41
|
+
return new LocalDate(d.getFullYear(), d.getMonth() + 1, d.getDate());
|
|
42
|
+
}
|
|
43
|
+
static today() {
|
|
44
|
+
return this.fromDate(new Date());
|
|
45
|
+
}
|
|
46
|
+
static sort(items, mutate = false, descending = false) {
|
|
47
|
+
const mod = descending ? -1 : 1;
|
|
48
|
+
return (mutate ? items : [...items]).sort((a, b) => a.cmp(b) * mod);
|
|
49
|
+
}
|
|
50
|
+
static earliestOrUndefined(items) {
|
|
51
|
+
return items.length ? LocalDate.earliest(items) : undefined;
|
|
52
|
+
}
|
|
53
|
+
static earliest(items) {
|
|
54
|
+
(0, assert_1._assert)(items.length, 'LocalDate.earliest called on empty array');
|
|
55
|
+
return items.reduce((min, item) => (min.isSameOrBefore(item) ? min : item));
|
|
56
|
+
}
|
|
57
|
+
static latestOrUndefined(items) {
|
|
58
|
+
return items.length ? LocalDate.latest(items) : undefined;
|
|
59
|
+
}
|
|
60
|
+
static latest(items) {
|
|
61
|
+
(0, assert_1._assert)(items.length, 'LocalDate.latest called on empty array');
|
|
62
|
+
return items.reduce((max, item) => (max.isSameOrAfter(item) ? max : item));
|
|
63
|
+
}
|
|
64
|
+
static range(minIncl, maxExcl, step = 1, stepUnit = 'day') {
|
|
65
|
+
const days = [];
|
|
66
|
+
let current = LocalDate.of(minIncl).startOf(stepUnit);
|
|
67
|
+
const max = LocalDate.of(maxExcl).startOf(stepUnit);
|
|
68
|
+
do {
|
|
69
|
+
days.push(current);
|
|
70
|
+
current = current.add(step, stepUnit);
|
|
71
|
+
} while (current.isBefore(max));
|
|
72
|
+
return days;
|
|
73
|
+
}
|
|
74
|
+
static rangeSeq(minIncl, maxExcl, step = 1, stepUnit = 'day') {
|
|
75
|
+
const min = LocalDate.of(minIncl).startOf(stepUnit);
|
|
76
|
+
const max = LocalDate.of(maxExcl).startOf(stepUnit);
|
|
77
|
+
return seq_1.Sequence.create(min, d => {
|
|
78
|
+
const next = d.add(step, stepUnit);
|
|
79
|
+
return next.isAfter(max) ? types_1.END : next;
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
static rangeString(minIncl, maxExcl, step = 1, stepUnit = 'day') {
|
|
83
|
+
return LocalDate.range(minIncl, maxExcl, step, stepUnit).map(ld => ld.toString());
|
|
84
|
+
}
|
|
85
|
+
static rangeIncl(minIncl, maxIncl, step = 1, stepUnit = 'day') {
|
|
86
|
+
return LocalDate.range(minIncl, LocalDate.of(maxIncl).add(1, stepUnit), step, stepUnit);
|
|
87
|
+
}
|
|
88
|
+
static rangeInclString(minIncl, maxIncl, step = 1, stepUnit = 'day') {
|
|
89
|
+
return LocalDate.range(minIncl, LocalDate.of(maxIncl).add(1, stepUnit), step, stepUnit).map(ld => ld.toString());
|
|
90
|
+
}
|
|
91
|
+
isSame(d) {
|
|
92
|
+
d = LocalDate.of(d);
|
|
93
|
+
return this.day === d.day && this.month === d.month && this.year === d.year;
|
|
94
|
+
}
|
|
95
|
+
isBefore(d) {
|
|
96
|
+
return this.cmp(d) === -1;
|
|
97
|
+
}
|
|
98
|
+
isSameOrBefore(d) {
|
|
99
|
+
return this.cmp(d) <= 0;
|
|
100
|
+
}
|
|
101
|
+
isAfter(d) {
|
|
102
|
+
return this.cmp(d) === 1;
|
|
103
|
+
}
|
|
104
|
+
isSameOrAfter(d) {
|
|
105
|
+
return this.cmp(d) >= 0;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Returns 1 if this > d
|
|
109
|
+
* returns 0 if they are equal
|
|
110
|
+
* returns -1 if this < d
|
|
111
|
+
*/
|
|
112
|
+
cmp(d) {
|
|
113
|
+
d = LocalDate.of(d);
|
|
114
|
+
if (this.year < d.year)
|
|
115
|
+
return -1;
|
|
116
|
+
if (this.year > d.year)
|
|
117
|
+
return 1;
|
|
118
|
+
if (this.month < d.month)
|
|
119
|
+
return -1;
|
|
120
|
+
if (this.month > d.month)
|
|
121
|
+
return 1;
|
|
122
|
+
if (this.day < d.day)
|
|
123
|
+
return -1;
|
|
124
|
+
if (this.day > d.day)
|
|
125
|
+
return 1;
|
|
126
|
+
return 0;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Same as Math.abs( diff )
|
|
130
|
+
*/
|
|
131
|
+
absDiff(d, unit) {
|
|
132
|
+
return Math.abs(this.diff(d, unit));
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Returns the number of **full** units difference (aka `Math.ceil`).
|
|
136
|
+
*
|
|
137
|
+
* a.diff(b) means "a minus b"
|
|
138
|
+
*/
|
|
139
|
+
diff(d, unit) {
|
|
140
|
+
d = LocalDate.of(d);
|
|
141
|
+
if (unit === 'year') {
|
|
142
|
+
return this.year - d.year;
|
|
143
|
+
}
|
|
144
|
+
if (unit === 'month') {
|
|
145
|
+
return (this.year - d.year) * 12 + (this.month - d.month);
|
|
146
|
+
}
|
|
147
|
+
// unit is 'day'
|
|
148
|
+
let days = this.day - d.day;
|
|
149
|
+
if (d.year < this.year) {
|
|
150
|
+
for (let year = d.year; year < this.year; year++) {
|
|
151
|
+
days += this.getYearDays(year);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
else if (this.year < d.year) {
|
|
155
|
+
for (let year = this.year; year < d.year; year++) {
|
|
156
|
+
days -= this.getYearDays(year);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
if (d.month < this.month) {
|
|
160
|
+
for (let month = d.month; month < this.month; month++) {
|
|
161
|
+
days += this.getMonthLen(this.year, month);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
else if (this.month < d.month) {
|
|
165
|
+
for (let month = this.month; month < d.month; month++) {
|
|
166
|
+
days -= this.getMonthLen(d.year, month);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return days;
|
|
170
|
+
}
|
|
171
|
+
add(num, unit, mutate = false) {
|
|
172
|
+
let { day, month, year } = this;
|
|
173
|
+
if (unit === 'day') {
|
|
174
|
+
day += num;
|
|
175
|
+
}
|
|
176
|
+
else if (unit === 'month') {
|
|
177
|
+
month += num;
|
|
178
|
+
}
|
|
179
|
+
else if (unit === 'year') {
|
|
180
|
+
year += num;
|
|
181
|
+
}
|
|
182
|
+
// check day overflow
|
|
183
|
+
let monLen = this.getMonthLen(year, month);
|
|
184
|
+
while (day > monLen) {
|
|
185
|
+
day -= monLen;
|
|
186
|
+
month += 1;
|
|
187
|
+
if (month > 12) {
|
|
188
|
+
year += 1;
|
|
189
|
+
month -= 12;
|
|
190
|
+
}
|
|
191
|
+
monLen = this.getMonthLen(year, month);
|
|
192
|
+
}
|
|
193
|
+
while (day < 1) {
|
|
194
|
+
day += monLen;
|
|
195
|
+
month -= 1;
|
|
196
|
+
if (month < 1) {
|
|
197
|
+
year -= 1;
|
|
198
|
+
month += 12;
|
|
199
|
+
}
|
|
200
|
+
monLen = this.getMonthLen(year, month);
|
|
201
|
+
}
|
|
202
|
+
// check month overflow
|
|
203
|
+
while (month > 12) {
|
|
204
|
+
year += 1;
|
|
205
|
+
month -= 12;
|
|
206
|
+
}
|
|
207
|
+
while (month < 1) {
|
|
208
|
+
year -= 1;
|
|
209
|
+
month += 12;
|
|
210
|
+
}
|
|
211
|
+
if (mutate) {
|
|
212
|
+
this.year = year;
|
|
213
|
+
this.month = month;
|
|
214
|
+
this.day = day;
|
|
215
|
+
return this;
|
|
216
|
+
}
|
|
217
|
+
return new LocalDate(year, month, day);
|
|
218
|
+
}
|
|
219
|
+
subtract(num, unit, mutate = false) {
|
|
220
|
+
return this.add(-num, unit, mutate);
|
|
221
|
+
}
|
|
222
|
+
startOf(unit) {
|
|
223
|
+
if (unit === 'day')
|
|
224
|
+
return this;
|
|
225
|
+
if (unit === 'month')
|
|
226
|
+
return LocalDate.create(this.year, this.month, 1);
|
|
227
|
+
// year
|
|
228
|
+
return LocalDate.create(this.year, 1, 1);
|
|
229
|
+
}
|
|
230
|
+
endOf(unit) {
|
|
231
|
+
if (unit === 'day')
|
|
232
|
+
return this;
|
|
233
|
+
if (unit === 'month')
|
|
234
|
+
return LocalDate.create(this.year, this.month, this.getMonthLen(this.year, this.month));
|
|
235
|
+
// year
|
|
236
|
+
return LocalDate.create(this.year, 12, 31);
|
|
237
|
+
}
|
|
238
|
+
getYearDays(year) {
|
|
239
|
+
return this.isLeapYear(year) ? 366 : 365;
|
|
240
|
+
}
|
|
241
|
+
getMonthLen(year, month) {
|
|
242
|
+
if (month === 2)
|
|
243
|
+
return this.isLeapYear(year) ? 29 : 28;
|
|
244
|
+
return m31.has(month) ? 31 : 30;
|
|
245
|
+
}
|
|
246
|
+
isLeapYear(year) {
|
|
247
|
+
if (year % 4 !== 0)
|
|
248
|
+
return false;
|
|
249
|
+
if (year % 100 !== 0)
|
|
250
|
+
return true;
|
|
251
|
+
return year % 400 === 0;
|
|
252
|
+
}
|
|
253
|
+
clone() {
|
|
254
|
+
return new LocalDate(this.year, this.month, this.day);
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Converts LocalDate into instance of Date.
|
|
258
|
+
* Year, month and day will match.
|
|
259
|
+
* Hour, minute, second, ms will be 0.
|
|
260
|
+
* Timezone will match local timezone.
|
|
261
|
+
*/
|
|
262
|
+
toDate() {
|
|
263
|
+
return new Date(this.year, this.month - 1, this.day);
|
|
264
|
+
}
|
|
265
|
+
toString() {
|
|
266
|
+
return [
|
|
267
|
+
String(this.year).padStart(4, '0'),
|
|
268
|
+
String(this.month).padStart(2, '0'),
|
|
269
|
+
String(this.day).padStart(2, '0'),
|
|
270
|
+
].join('-');
|
|
271
|
+
}
|
|
272
|
+
toStringCompact() {
|
|
273
|
+
return [
|
|
274
|
+
String(this.year).padStart(4, '0'),
|
|
275
|
+
String(this.month).padStart(2, '0'),
|
|
276
|
+
String(this.day).padStart(2, '0'),
|
|
277
|
+
].join('');
|
|
278
|
+
}
|
|
279
|
+
toJSON() {
|
|
280
|
+
return this.toString();
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
exports.LocalDate = LocalDate;
|
|
284
|
+
/**
|
|
285
|
+
* Shortcut wrapper around `LocalDate.parse` / `LocalDate.today`
|
|
286
|
+
*/
|
|
287
|
+
function localDate(d) {
|
|
288
|
+
return d ? LocalDate.of(d) : LocalDate.today();
|
|
289
|
+
}
|
|
290
|
+
exports.localDate = localDate;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { IsoDateTime, UnixTimestamp } from '../types';
|
|
2
|
+
export declare type LocalTimeUnit = 'year' | 'month' | 'day' | 'hour' | 'minute' | 'second';
|
|
3
|
+
export declare type LocalTimeConfig = LocalTime | Date | IsoDateTime | UnixTimestamp;
|
|
4
|
+
export interface LocalTimeComponents {
|
|
5
|
+
year: number;
|
|
6
|
+
month: number;
|
|
7
|
+
day: number;
|
|
8
|
+
hour: number;
|
|
9
|
+
minute: number;
|
|
10
|
+
second: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* @experimental
|
|
14
|
+
*/
|
|
15
|
+
export declare class LocalTime {
|
|
16
|
+
private $date;
|
|
17
|
+
private constructor();
|
|
18
|
+
/**
|
|
19
|
+
* Parses input String into LocalDate.
|
|
20
|
+
* Input can already be a LocalDate - it is returned as-is in that case.
|
|
21
|
+
*/
|
|
22
|
+
static of(d: LocalTimeConfig): LocalTime;
|
|
23
|
+
static unix(ts: UnixTimestamp): LocalTime;
|
|
24
|
+
static now(): LocalTime;
|
|
25
|
+
static fromComponents(c: {
|
|
26
|
+
year: number;
|
|
27
|
+
month: number;
|
|
28
|
+
} & Partial<LocalTimeComponents>): LocalTime;
|
|
29
|
+
get(unit: LocalTimeUnit): number;
|
|
30
|
+
set(unit: LocalTimeUnit, v: number, mutate?: boolean): LocalTime;
|
|
31
|
+
year(): number;
|
|
32
|
+
year(v: number): LocalTime;
|
|
33
|
+
month(): number;
|
|
34
|
+
month(v: number): LocalTime;
|
|
35
|
+
date(): number;
|
|
36
|
+
date(v: number): LocalTime;
|
|
37
|
+
hour(): number;
|
|
38
|
+
hour(v: number): LocalTime;
|
|
39
|
+
minute(): number;
|
|
40
|
+
minute(v: number): LocalTime;
|
|
41
|
+
second(): number;
|
|
42
|
+
second(v: number): LocalTime;
|
|
43
|
+
setComponents(c: Partial<LocalTimeComponents>, mutate?: boolean): LocalTime;
|
|
44
|
+
add(num: number, unit: LocalTimeUnit, mutate?: boolean): LocalTime;
|
|
45
|
+
subtract(num: number, unit: LocalTimeUnit, mutate?: boolean): LocalTime;
|
|
46
|
+
absDiff(other: LocalTimeConfig, unit: LocalTimeUnit): number;
|
|
47
|
+
diff(other: LocalTimeConfig, unit: LocalTimeUnit): number;
|
|
48
|
+
startOf(unit: LocalTimeUnit, mutate?: boolean): LocalTime;
|
|
49
|
+
static sort(items: LocalTime[], mutate?: boolean, descending?: boolean): LocalTime[];
|
|
50
|
+
static earliestOrUndefined(items: LocalTime[]): LocalTime | undefined;
|
|
51
|
+
static earliest(items: LocalTime[]): LocalTime;
|
|
52
|
+
static latestOrUndefined(items: LocalTime[]): LocalTime | undefined;
|
|
53
|
+
static latest(items: LocalTime[]): LocalTime;
|
|
54
|
+
isSame(d: LocalTimeConfig): boolean;
|
|
55
|
+
isBefore(d: LocalTimeConfig): boolean;
|
|
56
|
+
isSameOrBefore(d: LocalTimeConfig): boolean;
|
|
57
|
+
isAfter(d: LocalTimeConfig): boolean;
|
|
58
|
+
isSameOrAfter(d: LocalTimeConfig): boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Returns 1 if this > d
|
|
61
|
+
* returns 0 if they are equal
|
|
62
|
+
* returns -1 if this < d
|
|
63
|
+
*/
|
|
64
|
+
cmp(d: LocalTimeConfig): -1 | 0 | 1;
|
|
65
|
+
components(): LocalTimeComponents;
|
|
66
|
+
getDate(): Date;
|
|
67
|
+
clone(): LocalTime;
|
|
68
|
+
unix(): UnixTimestamp;
|
|
69
|
+
valueOf(): UnixTimestamp;
|
|
70
|
+
toISO8601(): IsoDateTime;
|
|
71
|
+
toPretty(): IsoDateTime;
|
|
72
|
+
toString(): string;
|
|
73
|
+
toJSON(): UnixTimestamp;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Shortcut wrapper around `LocalDate.parse` / `LocalDate.today`
|
|
77
|
+
*/
|
|
78
|
+
export declare function localTime(d?: LocalTimeConfig): LocalTime;
|