inferred-types 0.51.12 → 0.51.13
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/constants/tsconfig.tsbuildinfo +1 -1
- package/dist/index.cjs +155 -0
- package/dist/index.js +144 -0
- package/dist/inferred-types/tsconfig.tsbuildinfo +1 -1
- package/dist/runtime/datetime/getToday.d.ts +7 -0
- package/dist/runtime/datetime/getToday.d.ts.map +1 -0
- package/dist/runtime/datetime/getToday.js +8 -0
- package/dist/runtime/datetime/getTomorrow.d.ts +8 -0
- package/dist/runtime/datetime/getTomorrow.d.ts.map +1 -0
- package/dist/runtime/datetime/getTomorrow.js +10 -0
- package/dist/runtime/datetime/getYesterday.d.ts +8 -0
- package/dist/runtime/datetime/getYesterday.d.ts.map +1 -0
- package/dist/runtime/datetime/getYesterday.js +10 -0
- package/dist/runtime/datetime/index.d.ts +4 -0
- package/dist/runtime/datetime/index.d.ts.map +1 -0
- package/dist/runtime/datetime/index.js +3 -0
- package/dist/runtime/index.d.ts +1 -0
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +1 -0
- package/dist/runtime/tsconfig.tsbuildinfo +1 -1
- package/dist/runtime/type-guards/date-time/index.d.ts +8 -0
- package/dist/runtime/type-guards/date-time/index.d.ts.map +1 -1
- package/dist/runtime/type-guards/date-time/index.js +8 -0
- package/dist/runtime/type-guards/date-time/isDate.d.ts +5 -0
- package/dist/runtime/type-guards/date-time/isDate.d.ts.map +1 -0
- package/dist/runtime/type-guards/date-time/isDate.js +6 -0
- package/dist/runtime/type-guards/date-time/isLuxonDateTime.d.ts +7 -0
- package/dist/runtime/type-guards/date-time/isLuxonDateTime.d.ts.map +1 -0
- package/dist/runtime/type-guards/date-time/isLuxonDateTime.js +25 -0
- package/dist/runtime/type-guards/date-time/isMoment.d.ts +7 -0
- package/dist/runtime/type-guards/date-time/isMoment.d.ts.map +1 -0
- package/dist/runtime/type-guards/date-time/isMoment.js +25 -0
- package/dist/runtime/type-guards/date-time/isThisMonth.d.ts +7 -0
- package/dist/runtime/type-guards/date-time/isThisMonth.d.ts.map +1 -0
- package/dist/runtime/type-guards/date-time/isThisMonth.js +34 -0
- package/dist/runtime/type-guards/date-time/isThisYear.d.ts +7 -0
- package/dist/runtime/type-guards/date-time/isThisYear.d.ts.map +1 -0
- package/dist/runtime/type-guards/date-time/isThisYear.js +34 -0
- package/dist/runtime/type-guards/date-time/isToday.d.ts +13 -0
- package/dist/runtime/type-guards/date-time/isToday.d.ts.map +1 -0
- package/dist/runtime/type-guards/date-time/isToday.js +25 -0
- package/dist/runtime/type-guards/date-time/isTomorrow.d.ts +12 -0
- package/dist/runtime/type-guards/date-time/isTomorrow.d.ts.map +1 -0
- package/dist/runtime/type-guards/date-time/isTomorrow.js +24 -0
- package/dist/runtime/type-guards/date-time/isYesterday.d.ts +12 -0
- package/dist/runtime/type-guards/date-time/isYesterday.d.ts.map +1 -0
- package/dist/runtime/type-guards/date-time/isYesterday.js +24 -0
- package/dist/types/literals/date-time-objects.d.ts +690 -0
- package/dist/types/literals/date-time-objects.d.ts.map +1 -0
- package/dist/types/literals/date-time-objects.js +1 -0
- package/dist/types/literals/index.d.ts +1 -0
- package/dist/types/literals/index.d.ts.map +1 -1
- package/dist/types/literals/index.js +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -1
|
@@ -0,0 +1,690 @@
|
|
|
1
|
+
import { Iso8601DateTime } from "src/types/index";
|
|
2
|
+
type RelativeTimeKey = "s" | "ss" | "m" | "mm" | "h" | "hh" | "d" | "dd" | "w" | "ww" | "M" | "MM" | "y" | "yy";
|
|
3
|
+
type CalendarKey = "sameDay" | "nextDay" | "lastDay" | "nextWeek" | "lastWeek" | "sameElse" | string;
|
|
4
|
+
type LongDateFormatKey = "LTS" | "LT" | "L" | "LL" | "LLL" | "LLLL" | "lts" | "lt" | "l" | "ll" | "lll" | "llll";
|
|
5
|
+
/**
|
|
6
|
+
* **MomentJS**
|
|
7
|
+
*
|
|
8
|
+
* A type representing the [MomentJS](https://momentjs.com/docs/#/displaying/) library
|
|
9
|
+
*/
|
|
10
|
+
export type MomentJs = {
|
|
11
|
+
/**
|
|
12
|
+
* Formats a moment object into a calendar time string.
|
|
13
|
+
* @param key - A string key specifying the calendar format.
|
|
14
|
+
* @param m - A MomentJS object representing a comparison time.
|
|
15
|
+
* @param now - A MomentJS object representing the reference time (default is now).
|
|
16
|
+
*/
|
|
17
|
+
calendar(key?: CalendarKey, m?: MomentJs, now?: MomentJs): string;
|
|
18
|
+
/**
|
|
19
|
+
* Gets or sets long date format strings for a specific key.
|
|
20
|
+
* @param key - The key for the desired format (e.g., "LT", "LTS").
|
|
21
|
+
*/
|
|
22
|
+
longDateFormat(key: LongDateFormatKey): string;
|
|
23
|
+
/**
|
|
24
|
+
* Returns the string to use for invalid dates.
|
|
25
|
+
*/
|
|
26
|
+
invalidDate(): string;
|
|
27
|
+
/**
|
|
28
|
+
* Formats an ordinal number (e.g., 1st, 2nd, 3rd).
|
|
29
|
+
* @param n - The number to format.
|
|
30
|
+
*/
|
|
31
|
+
ordinal(n: number): string;
|
|
32
|
+
/**
|
|
33
|
+
* Prepares an input string for parsing (custom pre-parsing logic).
|
|
34
|
+
* @param inp - The input string to preprocess.
|
|
35
|
+
*/
|
|
36
|
+
preparse(inp: string): string;
|
|
37
|
+
/**
|
|
38
|
+
* Formats an output string (custom post-formatting logic).
|
|
39
|
+
* @param inp - The input string to postprocess.
|
|
40
|
+
*/
|
|
41
|
+
postformat(inp: string): string;
|
|
42
|
+
/**
|
|
43
|
+
* Formats relative time strings (e.g., "in 5 minutes", "5 minutes ago").
|
|
44
|
+
* @param n - The number to format (e.g., 5 for "5 minutes").
|
|
45
|
+
* @param withoutSuffix - Whether to exclude the suffix (e.g., "ago" or "in").
|
|
46
|
+
* @param key - The time unit (e.g., "s" for seconds, "m" for minutes).
|
|
47
|
+
* @param isFuture - Whether the time is in the future.
|
|
48
|
+
*/
|
|
49
|
+
relativeTime(n: number, withoutSuffix: boolean, key: RelativeTimeKey, isFuture: boolean): string;
|
|
50
|
+
/**
|
|
51
|
+
* Formats relative time for past or future comparisons.
|
|
52
|
+
* @param diff - The time difference in milliseconds.
|
|
53
|
+
* @param absRelTime - The absolute relative time string.
|
|
54
|
+
*/
|
|
55
|
+
pastFuture(diff: number, absRelTime: string): string;
|
|
56
|
+
/**
|
|
57
|
+
* Sets specific configuration values for the moment object.
|
|
58
|
+
* @param config - An object containing configuration keys and values.
|
|
59
|
+
*/
|
|
60
|
+
set(config: object): void;
|
|
61
|
+
/**
|
|
62
|
+
* Converts the MomentJS object to an ISO 8601 string.
|
|
63
|
+
*/
|
|
64
|
+
toISOString(): Iso8601DateTime;
|
|
65
|
+
/**
|
|
66
|
+
* Converts the MomentJS object to a JavaScript Date object.
|
|
67
|
+
*/
|
|
68
|
+
toDate(): Date;
|
|
69
|
+
/**
|
|
70
|
+
* Converts the MomentJS object to a Unix timestamp in milliseconds.
|
|
71
|
+
*/
|
|
72
|
+
valueOf(): number;
|
|
73
|
+
/**
|
|
74
|
+
* Converts the MomentJS object to a Unix timestamp in seconds.
|
|
75
|
+
*/
|
|
76
|
+
unix(): number;
|
|
77
|
+
/**
|
|
78
|
+
* Converts the MomentJS object to a JSON string.
|
|
79
|
+
*/
|
|
80
|
+
toJSON(): string;
|
|
81
|
+
/**
|
|
82
|
+
* Formats the MomentJS object as a string using a specific format.
|
|
83
|
+
* @param format - A string specifying the format to use.
|
|
84
|
+
*/
|
|
85
|
+
format(format?: string): string;
|
|
86
|
+
/**
|
|
87
|
+
* Clones the current MomentJS object.
|
|
88
|
+
*/
|
|
89
|
+
clone(): MomentJs;
|
|
90
|
+
/**
|
|
91
|
+
* Checks if the MomentJS object is valid.
|
|
92
|
+
*/
|
|
93
|
+
isValid(): boolean;
|
|
94
|
+
/**
|
|
95
|
+
* Checks if the MomentJS object is the same as another moment.
|
|
96
|
+
* @param other - The moment to compare with.
|
|
97
|
+
* @param granularity - The level of precision to compare at (e.g., "day", "hour").
|
|
98
|
+
*/
|
|
99
|
+
isSame(other: MomentJs, granularity?: string): boolean;
|
|
100
|
+
/**
|
|
101
|
+
* Checks if the MomentJS object is before another moment.
|
|
102
|
+
* @param other - The moment to compare with.
|
|
103
|
+
* @param granularity - The level of precision to compare at (e.g., "day", "hour").
|
|
104
|
+
*/
|
|
105
|
+
isBefore(other: MomentJs, granularity?: string): boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Checks if the MomentJS object is after another moment.
|
|
108
|
+
* @param other - The moment to compare with.
|
|
109
|
+
* @param granularity - The level of precision to compare at (e.g., "day", "hour").
|
|
110
|
+
*/
|
|
111
|
+
isAfter(other: MomentJs, granularity?: string): boolean;
|
|
112
|
+
/**
|
|
113
|
+
* Checks if the MomentJS object is between two other moments.
|
|
114
|
+
* @param from - The starting moment.
|
|
115
|
+
* @param to - The ending moment.
|
|
116
|
+
* @param granularity - The level of precision to compare at (e.g., "day", "hour").
|
|
117
|
+
* @param inclusivity - Controls whether the bounds are inclusive (`"[]"`) or exclusive (`"()"`).
|
|
118
|
+
*/
|
|
119
|
+
isBetween(from: MomentJs, to: MomentJs, granularity?: string, inclusivity?: string): boolean;
|
|
120
|
+
/**
|
|
121
|
+
* Adds a duration to the MomentJS object.
|
|
122
|
+
* @param amount - The amount to add.
|
|
123
|
+
* @param unit - The unit to add (e.g., "days", "hours").
|
|
124
|
+
*/
|
|
125
|
+
add(amount: number, unit: string): MomentJs;
|
|
126
|
+
/**
|
|
127
|
+
* Subtracts a duration from the MomentJS object.
|
|
128
|
+
* @param amount - The amount to subtract.
|
|
129
|
+
* @param unit - The unit to subtract (e.g., "days", "hours").
|
|
130
|
+
*/
|
|
131
|
+
subtract(amount: number, unit: string): MomentJs;
|
|
132
|
+
/**
|
|
133
|
+
* Sets specific components of the MomentJS object.
|
|
134
|
+
* @param unit - The unit to set (e.g., "year", "month").
|
|
135
|
+
* @param value - The value to set the unit to.
|
|
136
|
+
*/
|
|
137
|
+
set(unit: string, value: number): MomentJs;
|
|
138
|
+
/**
|
|
139
|
+
* Starts a range of time for the MomentJS object.
|
|
140
|
+
* @param unit - The unit to start at (e.g., "day", "month").
|
|
141
|
+
*/
|
|
142
|
+
startOf(unit: string): MomentJs;
|
|
143
|
+
/**
|
|
144
|
+
* Ends a range of time for the MomentJS object.
|
|
145
|
+
* @param unit - The unit to end at (e.g., "day", "month").
|
|
146
|
+
*/
|
|
147
|
+
endOf(unit: string): MomentJs;
|
|
148
|
+
/**
|
|
149
|
+
* Gets the difference between this MomentJS object and another.
|
|
150
|
+
* @param other - The moment to compare with.
|
|
151
|
+
* @param unit - The unit to measure the difference in (e.g., "days", "hours").
|
|
152
|
+
* @param precise - Whether to return a precise value (default is false).
|
|
153
|
+
*/
|
|
154
|
+
diff(other: MomentJs, unit?: string, precise?: boolean): number;
|
|
155
|
+
/**
|
|
156
|
+
* Gets or sets the time zone offset for the MomentJS object.
|
|
157
|
+
* @param input - If provided, sets the offset to this value (in minutes).
|
|
158
|
+
*/
|
|
159
|
+
utcOffset(input?: number): number;
|
|
160
|
+
/**
|
|
161
|
+
* Changes the locale for the current MomentJS object.
|
|
162
|
+
* @param locale - The locale to set.
|
|
163
|
+
* @returns The current locale if no arguments are provided.
|
|
164
|
+
*/
|
|
165
|
+
locale(locale?: string): string;
|
|
166
|
+
/**
|
|
167
|
+
* Gets or sets the first day of the week.
|
|
168
|
+
* @param input - The day to set as the first day of the week (0 = Sunday, 1 = Monday).
|
|
169
|
+
*/
|
|
170
|
+
weekday(input?: number): number;
|
|
171
|
+
/**
|
|
172
|
+
* Gets an array of all month names.
|
|
173
|
+
*/
|
|
174
|
+
months(): string[];
|
|
175
|
+
/**
|
|
176
|
+
* Gets the month name for a specific moment object.
|
|
177
|
+
* @param m - The moment object to retrieve the month for.
|
|
178
|
+
* @param format - The format string to use (optional).
|
|
179
|
+
*/
|
|
180
|
+
months(m: MomentJs, format?: string): string;
|
|
181
|
+
/**
|
|
182
|
+
* Gets an array of all short month names.
|
|
183
|
+
*/
|
|
184
|
+
monthsShort(): string[];
|
|
185
|
+
/**
|
|
186
|
+
* Gets the short month name for a specific moment object.
|
|
187
|
+
* @param m - The moment object to retrieve the short month for.
|
|
188
|
+
* @param format - The format string to use (optional).
|
|
189
|
+
*/
|
|
190
|
+
monthsShort(m: MomentJs, format?: string): string;
|
|
191
|
+
/**
|
|
192
|
+
* Parses a month name and returns the corresponding month index.
|
|
193
|
+
* @param monthName - The name of the month to parse.
|
|
194
|
+
* @param format - The format string to use.
|
|
195
|
+
* @param strict - Whether to enforce strict parsing.
|
|
196
|
+
*/
|
|
197
|
+
monthsParse(monthName: string, format: string, strict: boolean): number;
|
|
198
|
+
/**
|
|
199
|
+
* Returns a regex pattern for matching month names.
|
|
200
|
+
* @param strict - Whether to enforce strict parsing.
|
|
201
|
+
*/
|
|
202
|
+
monthsRegex(strict: boolean): RegExp;
|
|
203
|
+
/**
|
|
204
|
+
* Returns a regex pattern for matching short month names.
|
|
205
|
+
* @param strict - Whether to enforce strict parsing.
|
|
206
|
+
*/
|
|
207
|
+
monthsShortRegex(strict: boolean): RegExp;
|
|
208
|
+
/**
|
|
209
|
+
* Gets the ISO week number for a specific moment object.
|
|
210
|
+
* @param m - The moment object to retrieve the week number for.
|
|
211
|
+
*/
|
|
212
|
+
week(m: MomentJs): number;
|
|
213
|
+
/**
|
|
214
|
+
* Gets the day of the year that the week starts on.
|
|
215
|
+
*/
|
|
216
|
+
firstDayOfYear(): number;
|
|
217
|
+
/**
|
|
218
|
+
* Gets the first day of the week (e.g., Sunday or Monday).
|
|
219
|
+
*/
|
|
220
|
+
firstDayOfWeek(): number;
|
|
221
|
+
/**
|
|
222
|
+
* Gets an array of all weekday names.
|
|
223
|
+
*/
|
|
224
|
+
weekdays(): string[];
|
|
225
|
+
/**
|
|
226
|
+
* Gets the weekday name for a specific moment object.
|
|
227
|
+
* @param m - The moment object to retrieve the weekday for.
|
|
228
|
+
* @param format - The format string to use (optional).
|
|
229
|
+
*/
|
|
230
|
+
weekdays(m: MomentJs, format?: string): string;
|
|
231
|
+
/**
|
|
232
|
+
* Gets an array of all short weekday names.
|
|
233
|
+
*/
|
|
234
|
+
weekdaysShort(): string[];
|
|
235
|
+
/**
|
|
236
|
+
* Gets the short weekday name for a specific moment object.
|
|
237
|
+
* @param m - The moment object to retrieve the short weekday for.
|
|
238
|
+
*/
|
|
239
|
+
weekdaysShort(m: MomentJs): string;
|
|
240
|
+
/**
|
|
241
|
+
* Gets an array of all minimum weekday names (e.g., "Mo", "Tu").
|
|
242
|
+
*/
|
|
243
|
+
weekdaysMin(): string[];
|
|
244
|
+
/**
|
|
245
|
+
* Gets the minimum weekday name for a specific moment object.
|
|
246
|
+
* @param m - The moment object to retrieve the minimum weekday for.
|
|
247
|
+
*/
|
|
248
|
+
weekdaysMin(m: MomentJs): string;
|
|
249
|
+
/**
|
|
250
|
+
* Parses a weekday name and returns the corresponding day index.
|
|
251
|
+
* @param weekdayName - The name of the weekday to parse.
|
|
252
|
+
* @param format - The format string to use.
|
|
253
|
+
* @param strict - Whether to enforce strict parsing.
|
|
254
|
+
*/
|
|
255
|
+
weekdaysParse(weekdayName: string, format: string, strict: boolean): number;
|
|
256
|
+
/**
|
|
257
|
+
* Returns a regex pattern for matching weekday names.
|
|
258
|
+
* @param strict - Whether to enforce strict parsing.
|
|
259
|
+
*/
|
|
260
|
+
weekdaysRegex(strict: boolean): RegExp;
|
|
261
|
+
/**
|
|
262
|
+
* Returns a regex pattern for matching short weekday names.
|
|
263
|
+
* @param strict - Whether to enforce strict parsing.
|
|
264
|
+
*/
|
|
265
|
+
weekdaysShortRegex(strict: boolean): RegExp;
|
|
266
|
+
/**
|
|
267
|
+
* Returns a regex pattern for matching minimum weekday names.
|
|
268
|
+
* @param strict - Whether to enforce strict parsing.
|
|
269
|
+
*/
|
|
270
|
+
weekdaysMinRegex(strict: boolean): RegExp;
|
|
271
|
+
/**
|
|
272
|
+
* Checks if the given input string represents a PM time.
|
|
273
|
+
* @param input - The string to check.
|
|
274
|
+
*/
|
|
275
|
+
isPM(input: string): boolean;
|
|
276
|
+
/**
|
|
277
|
+
* Formats a time in 12-hour AM/PM format.
|
|
278
|
+
* @param hour - The hour value (0-23).
|
|
279
|
+
* @param minute - The minute value (0-59).
|
|
280
|
+
* @param isLower - Whether to return lowercase (e.g., "am" or "pm").
|
|
281
|
+
*/
|
|
282
|
+
meridiem(hour: number, minute: number, isLower: boolean): string;
|
|
283
|
+
/**
|
|
284
|
+
* Gets or sets the year.
|
|
285
|
+
* @param value - If provided, sets the year to this value.
|
|
286
|
+
* @returns The year if no argument is provided, or a MomentJs instance if setting.
|
|
287
|
+
*/
|
|
288
|
+
year(value?: number): number | MomentJs;
|
|
289
|
+
/**
|
|
290
|
+
* Gets or sets the month (0-11).
|
|
291
|
+
* @param value - If provided, sets the month to this value.
|
|
292
|
+
* @returns The month if no argument is provided, or a MomentJs instance if setting.
|
|
293
|
+
*/
|
|
294
|
+
month(value?: number): number | MomentJs;
|
|
295
|
+
/**
|
|
296
|
+
* Gets or sets the day of the month.
|
|
297
|
+
* @param value - If provided, sets the day to this value.
|
|
298
|
+
* @returns The day if no argument is provided, or a MomentJs instance if setting.
|
|
299
|
+
*/
|
|
300
|
+
date(value?: number): number | MomentJs;
|
|
301
|
+
/**
|
|
302
|
+
* Gets or sets the hour.
|
|
303
|
+
* @param value - If provided, sets the hour to this value.
|
|
304
|
+
* @returns The hour if no argument is provided, or a MomentJs instance if setting.
|
|
305
|
+
*/
|
|
306
|
+
hour(value?: number): number | MomentJs;
|
|
307
|
+
/**
|
|
308
|
+
* Gets or sets the minute.
|
|
309
|
+
* @param value - If provided, sets the minute to this value.
|
|
310
|
+
* @returns The minute if no argument is provided, or a MomentJs instance if setting.
|
|
311
|
+
*/
|
|
312
|
+
minute(value?: number): number | MomentJs;
|
|
313
|
+
/**
|
|
314
|
+
* Gets or sets the second.
|
|
315
|
+
* @param value - If provided, sets the second to this value.
|
|
316
|
+
* @returns The second if no argument is provided, or a MomentJs instance if setting.
|
|
317
|
+
*/
|
|
318
|
+
second(value?: number): number | MomentJs;
|
|
319
|
+
/**
|
|
320
|
+
* Gets or sets the millisecond.
|
|
321
|
+
* @param value - If provided, sets the millisecond to this value.
|
|
322
|
+
* @returns The millisecond if no argument is provided, or a MomentJs instance if setting.
|
|
323
|
+
*/
|
|
324
|
+
millisecond(value?: number): number | MomentJs;
|
|
325
|
+
/**
|
|
326
|
+
* Gets the day of the year (1-366).
|
|
327
|
+
* @returns The day of the year.
|
|
328
|
+
*/
|
|
329
|
+
dayOfYear(): number;
|
|
330
|
+
};
|
|
331
|
+
/**
|
|
332
|
+
* A representation of the [Luxon](https://moment.github.io/luxon/#/?id=luxon) library's type system
|
|
333
|
+
*/
|
|
334
|
+
export type LuxonJs = {
|
|
335
|
+
calendars: {
|
|
336
|
+
standard: {
|
|
337
|
+
months: string[];
|
|
338
|
+
weekdays: string[];
|
|
339
|
+
};
|
|
340
|
+
gregory: {
|
|
341
|
+
months: string[];
|
|
342
|
+
weekdays: string[];
|
|
343
|
+
};
|
|
344
|
+
};
|
|
345
|
+
Duration: {
|
|
346
|
+
/**
|
|
347
|
+
* Create a Duration from an object specifying units and their values.
|
|
348
|
+
* @param values - An object with time unit keys like `hours` and `minutes`.
|
|
349
|
+
*/
|
|
350
|
+
fromObject(values: {
|
|
351
|
+
[unit: string]: number;
|
|
352
|
+
}): LuxonJs["Duration"];
|
|
353
|
+
/**
|
|
354
|
+
* Create a Duration from a number of milliseconds.
|
|
355
|
+
* @param milliseconds - The number of milliseconds.
|
|
356
|
+
*/
|
|
357
|
+
fromMillis(milliseconds: number): LuxonJs["Duration"];
|
|
358
|
+
/**
|
|
359
|
+
* Create a Duration from an ISO 8601 duration string.
|
|
360
|
+
* @param isoString - The ISO duration string to parse.
|
|
361
|
+
*/
|
|
362
|
+
fromISO(isoString: string): LuxonJs["Duration"];
|
|
363
|
+
/**
|
|
364
|
+
* Create a Duration from a number of seconds.
|
|
365
|
+
* @param seconds - The number of seconds.
|
|
366
|
+
*/
|
|
367
|
+
fromSeconds(seconds: number): LuxonJs["Duration"];
|
|
368
|
+
/** The amount of years in this Duration. */
|
|
369
|
+
years: number;
|
|
370
|
+
/** The amount of months in this Duration. */
|
|
371
|
+
months: number;
|
|
372
|
+
/** The amount of weeks in this Duration. */
|
|
373
|
+
weeks: number;
|
|
374
|
+
/** The amount of days in this Duration. */
|
|
375
|
+
days: number;
|
|
376
|
+
/** The amount of hours in this Duration. */
|
|
377
|
+
hours: number;
|
|
378
|
+
/** The amount of minutes in this Duration. */
|
|
379
|
+
minutes: number;
|
|
380
|
+
/** The amount of seconds in this Duration. */
|
|
381
|
+
seconds: number;
|
|
382
|
+
/** The amount of milliseconds in this Duration. */
|
|
383
|
+
milliseconds: number;
|
|
384
|
+
/** Indicates whether this Duration is valid. */
|
|
385
|
+
isValid: boolean;
|
|
386
|
+
/** The reason why this Duration is invalid, if applicable. */
|
|
387
|
+
invalidReason: string | null;
|
|
388
|
+
/** Additional details about why this Duration is invalid. */
|
|
389
|
+
invalidExplanation: string | null;
|
|
390
|
+
/**
|
|
391
|
+
* Get the value of a specific unit in this Duration.
|
|
392
|
+
* @param unit - The unit to retrieve (e.g., `"hours"` or `"days"`).
|
|
393
|
+
*/
|
|
394
|
+
get(unit: "years" | "months" | "weeks" | "days" | "hours" | "minutes" | "seconds" | "milliseconds"): number;
|
|
395
|
+
/**
|
|
396
|
+
* Convert this Duration to an ISO 8601 string.
|
|
397
|
+
*/
|
|
398
|
+
toISO(): string;
|
|
399
|
+
/**
|
|
400
|
+
* Convert this Duration to a JavaScript object with time unit keys.
|
|
401
|
+
*/
|
|
402
|
+
toObject(): {
|
|
403
|
+
[unit: string]: number;
|
|
404
|
+
};
|
|
405
|
+
/**
|
|
406
|
+
* Convert this Duration to a number of milliseconds.
|
|
407
|
+
*/
|
|
408
|
+
toMillis(): number;
|
|
409
|
+
/**
|
|
410
|
+
* Normalize this Duration, shifting larger units down to smaller units.
|
|
411
|
+
*/
|
|
412
|
+
normalize(): LuxonJs["Duration"];
|
|
413
|
+
/**
|
|
414
|
+
* Add another Duration to this Duration.
|
|
415
|
+
* @param other - The Duration to add.
|
|
416
|
+
*/
|
|
417
|
+
plus(other: LuxonJs["Duration"] | {
|
|
418
|
+
[unit: string]: number;
|
|
419
|
+
}): LuxonJs["Duration"];
|
|
420
|
+
/**
|
|
421
|
+
* Subtract another Duration from this Duration.
|
|
422
|
+
* @param other - The Duration to subtract.
|
|
423
|
+
*/
|
|
424
|
+
minus(other: LuxonJs["Duration"] | {
|
|
425
|
+
[unit: string]: number;
|
|
426
|
+
}): LuxonJs["Duration"];
|
|
427
|
+
/**
|
|
428
|
+
* Scale this Duration by a factor.
|
|
429
|
+
* @param factor - The factor to scale by.
|
|
430
|
+
*/
|
|
431
|
+
mapUnits(factor: number): LuxonJs["Duration"];
|
|
432
|
+
/**
|
|
433
|
+
* Reconfigure this Duration's locale and numbering system.
|
|
434
|
+
* @param opts - Configuration options like `locale` or `numberingSystem`.
|
|
435
|
+
*/
|
|
436
|
+
reconfigure(opts: {
|
|
437
|
+
locale?: string;
|
|
438
|
+
numberingSystem?: string;
|
|
439
|
+
}): LuxonJs["Duration"];
|
|
440
|
+
};
|
|
441
|
+
DateTime: {
|
|
442
|
+
/**
|
|
443
|
+
* Create a DateTime instance from a string and a format.
|
|
444
|
+
* @param inp - The date/time string to parse.
|
|
445
|
+
* @param format - The format string to interpret `inp`.
|
|
446
|
+
* @param opts - Options to customize parsing, like `locale` or `zone`.
|
|
447
|
+
*/
|
|
448
|
+
fromFormat(inp: string, format: string, opts?: object): LuxonJs["DateTime"];
|
|
449
|
+
/**
|
|
450
|
+
* Create a DateTime instance from an SQL date/time string.
|
|
451
|
+
* @param inp - The SQL string to parse.
|
|
452
|
+
* @param opts - Options to customize parsing, like `zone`.
|
|
453
|
+
*/
|
|
454
|
+
fromSQL(inp: string, opts?: object): LuxonJs["DateTime"];
|
|
455
|
+
/**
|
|
456
|
+
* Create a DateTime instance in the local time zone.
|
|
457
|
+
* Accepts optional values for date and time components.
|
|
458
|
+
*/
|
|
459
|
+
local(year?: number, month?: number, day?: number, hour?: number, minute?: number, second?: number, millisecond?: number): LuxonJs["DateTime"];
|
|
460
|
+
/**
|
|
461
|
+
* Create a DateTime instance in the UTC time zone.
|
|
462
|
+
* Accepts optional values for date and time components.
|
|
463
|
+
*/
|
|
464
|
+
utc(year?: number, month?: number, day?: number, hour?: number, minute?: number, second?: number, millisecond?: number): LuxonJs["DateTime"];
|
|
465
|
+
/**
|
|
466
|
+
* Get the current date and time as a DateTime instance.
|
|
467
|
+
* @param zone - Optional time zone for the instance.
|
|
468
|
+
*/
|
|
469
|
+
now(zone?: string): LuxonJs["DateTime"];
|
|
470
|
+
/**
|
|
471
|
+
* Create a DateTime instance from an object specifying date and time components.
|
|
472
|
+
* @param config - Object with properties like `year`, `month`, `day`, etc.
|
|
473
|
+
*/
|
|
474
|
+
fromObject(config: {
|
|
475
|
+
zone?: string;
|
|
476
|
+
locale?: string;
|
|
477
|
+
numberingSystem?: string;
|
|
478
|
+
[key: string]: any;
|
|
479
|
+
}): LuxonJs["DateTime"];
|
|
480
|
+
/**
|
|
481
|
+
* Create a DateTime instance from a JavaScript Date object.
|
|
482
|
+
* @param date - The JavaScript Date object to convert.
|
|
483
|
+
* @param opts - Options to customize conversion, like `zone`.
|
|
484
|
+
*/
|
|
485
|
+
fromJSDate(date: Date, opts?: {
|
|
486
|
+
zone?: string;
|
|
487
|
+
locale?: string;
|
|
488
|
+
}): LuxonJs["DateTime"];
|
|
489
|
+
/**
|
|
490
|
+
* Create a DateTime instance from a number of milliseconds since the epoch.
|
|
491
|
+
* @param milliseconds - Milliseconds since January 1, 1970.
|
|
492
|
+
* @param opts - Options like `zone` or `locale`.
|
|
493
|
+
*/
|
|
494
|
+
fromMillis(milliseconds: number, opts?: {
|
|
495
|
+
zone?: string;
|
|
496
|
+
locale?: string;
|
|
497
|
+
}): LuxonJs["DateTime"];
|
|
498
|
+
/**
|
|
499
|
+
* Create a DateTime instance from a number of seconds since the epoch.
|
|
500
|
+
* @param seconds - Seconds since January 1, 1970.
|
|
501
|
+
* @param opts - Options like `zone` or `locale`.
|
|
502
|
+
*/
|
|
503
|
+
fromSeconds(seconds: number, opts?: {
|
|
504
|
+
zone?: string;
|
|
505
|
+
locale?: string;
|
|
506
|
+
}): LuxonJs["DateTime"];
|
|
507
|
+
/**
|
|
508
|
+
* Determine if the given input is a valid JavaScript Date object.
|
|
509
|
+
* @param input - The value to check.
|
|
510
|
+
* @returns True if `input` is a Date object, otherwise false.
|
|
511
|
+
*/
|
|
512
|
+
isDate(input: unknown): input is Date;
|
|
513
|
+
/**
|
|
514
|
+
* Create an invalid DateTime instance.
|
|
515
|
+
* @param reason - A string describing why the instance is invalid.
|
|
516
|
+
*/
|
|
517
|
+
invalid(reason: string): LuxonJs["DateTime"];
|
|
518
|
+
/**
|
|
519
|
+
* Format the DateTime as a string using a specified format.
|
|
520
|
+
* @param format - The format string.
|
|
521
|
+
* @param opts - Options like `locale` for formatting.
|
|
522
|
+
*/
|
|
523
|
+
toFormat(format: string, opts?: {
|
|
524
|
+
locale?: string;
|
|
525
|
+
}): string;
|
|
526
|
+
/**
|
|
527
|
+
* Convert the DateTime to a SQL-compatible date/time string.
|
|
528
|
+
* @param opts - Options to include the time zone or offset in the string.
|
|
529
|
+
*/
|
|
530
|
+
toSQL(opts?: {
|
|
531
|
+
includeZone?: boolean;
|
|
532
|
+
includeOffset?: boolean;
|
|
533
|
+
}): string;
|
|
534
|
+
/**
|
|
535
|
+
* Convert the DateTime to an ISO 8601 string.
|
|
536
|
+
* @param opts - Options to suppress milliseconds, seconds, or include the offset.
|
|
537
|
+
*/
|
|
538
|
+
toISO(opts?: {
|
|
539
|
+
suppressMilliseconds?: boolean;
|
|
540
|
+
suppressSeconds?: boolean;
|
|
541
|
+
includeOffset?: boolean;
|
|
542
|
+
}): string;
|
|
543
|
+
/**
|
|
544
|
+
* Convert the DateTime to an ISO 8601 date-only string.
|
|
545
|
+
*/
|
|
546
|
+
toISODate(): string;
|
|
547
|
+
/**
|
|
548
|
+
* Convert the DateTime to an ISO 8601 time-only string.
|
|
549
|
+
* @param opts - Options to suppress milliseconds, seconds, or include the offset.
|
|
550
|
+
*/
|
|
551
|
+
toISOTime(opts?: {
|
|
552
|
+
suppressMilliseconds?: boolean;
|
|
553
|
+
suppressSeconds?: boolean;
|
|
554
|
+
includeOffset?: boolean;
|
|
555
|
+
}): string;
|
|
556
|
+
/**
|
|
557
|
+
* Convert the DateTime to a JavaScript Date object.
|
|
558
|
+
*/
|
|
559
|
+
toJSDate(): Date;
|
|
560
|
+
/**
|
|
561
|
+
* Convert the DateTime to a string representation.
|
|
562
|
+
*/
|
|
563
|
+
toString(): string;
|
|
564
|
+
/**
|
|
565
|
+
* Get the number of milliseconds since the epoch for this DateTime.
|
|
566
|
+
*/
|
|
567
|
+
toMillis(): number;
|
|
568
|
+
/**
|
|
569
|
+
* Get the number of seconds since the epoch for this DateTime.
|
|
570
|
+
*/
|
|
571
|
+
toSeconds(): number;
|
|
572
|
+
/**
|
|
573
|
+
* Add a duration to this DateTime.
|
|
574
|
+
* @param duration - An object specifying the amount to add, e.g., `{ days: 1 }`.
|
|
575
|
+
*/
|
|
576
|
+
plus(duration: {
|
|
577
|
+
years?: number;
|
|
578
|
+
months?: number;
|
|
579
|
+
days?: number;
|
|
580
|
+
hours?: number;
|
|
581
|
+
minutes?: number;
|
|
582
|
+
seconds?: number;
|
|
583
|
+
milliseconds?: number;
|
|
584
|
+
}): LuxonJs["DateTime"];
|
|
585
|
+
/**
|
|
586
|
+
* Subtract a duration from this DateTime.
|
|
587
|
+
* @param duration - An object specifying the amount to subtract, e.g., `{ days: 1 }`.
|
|
588
|
+
*/
|
|
589
|
+
minus(duration: {
|
|
590
|
+
years?: number;
|
|
591
|
+
months?: number;
|
|
592
|
+
days?: number;
|
|
593
|
+
hours?: number;
|
|
594
|
+
minutes?: number;
|
|
595
|
+
seconds?: number;
|
|
596
|
+
milliseconds?: number;
|
|
597
|
+
}): LuxonJs["DateTime"];
|
|
598
|
+
/**
|
|
599
|
+
* Get the start of a specified time unit (e.g., start of the day).
|
|
600
|
+
* @param unit - The unit, such as `"year"` or `"day"`.
|
|
601
|
+
*/
|
|
602
|
+
startOf(unit: "year" | "month" | "week" | "day" | "hour" | "minute" | "second" | "millisecond"): LuxonJs["DateTime"];
|
|
603
|
+
/**
|
|
604
|
+
* Get the end of a specified time unit (e.g., end of the day).
|
|
605
|
+
* @param unit - The unit, such as `"year"` or `"day"`.
|
|
606
|
+
*/
|
|
607
|
+
endOf(unit: "year" | "month" | "week" | "day" | "hour" | "minute" | "second" | "millisecond"): LuxonJs["DateTime"];
|
|
608
|
+
/**
|
|
609
|
+
* Set specific components of the DateTime (e.g., change the year or month).
|
|
610
|
+
* @param values - An object with the components to set.
|
|
611
|
+
*/
|
|
612
|
+
set(values: {
|
|
613
|
+
year?: number;
|
|
614
|
+
month?: number;
|
|
615
|
+
day?: number;
|
|
616
|
+
hour?: number;
|
|
617
|
+
minute?: number;
|
|
618
|
+
second?: number;
|
|
619
|
+
millisecond?: number;
|
|
620
|
+
zone?: string;
|
|
621
|
+
locale?: string;
|
|
622
|
+
}): LuxonJs["DateTime"];
|
|
623
|
+
/**
|
|
624
|
+
* Change the locale, numbering system, or calendar system of the DateTime.
|
|
625
|
+
* @param values - An object specifying the new configuration.
|
|
626
|
+
*/
|
|
627
|
+
reconfigure(values: {
|
|
628
|
+
locale?: string;
|
|
629
|
+
numberingSystem?: string;
|
|
630
|
+
outputCalendar?: string;
|
|
631
|
+
}): LuxonJs["DateTime"];
|
|
632
|
+
/**
|
|
633
|
+
* Change the time zone of the DateTime.
|
|
634
|
+
* @param zone - The new time zone.
|
|
635
|
+
* @param opts - Options to keep the local time or calendar time.
|
|
636
|
+
*/
|
|
637
|
+
setZone(zone: string, opts?: {
|
|
638
|
+
keepLocalTime?: boolean;
|
|
639
|
+
keepCalendarTime?: boolean;
|
|
640
|
+
}): LuxonJs["DateTime"];
|
|
641
|
+
/**
|
|
642
|
+
* Get the specified unit of the DateTime (e.g., the year or month).
|
|
643
|
+
* @param unit - The unit to retrieve.
|
|
644
|
+
*/
|
|
645
|
+
get(unit: "year" | "month" | "day" | "hour" | "minute" | "second" | "millisecond"): number;
|
|
646
|
+
/**
|
|
647
|
+
* Calculate the difference between this DateTime and another.
|
|
648
|
+
* @param other - The other DateTime to compare against.
|
|
649
|
+
* @param unit - The units to calculate the difference in.
|
|
650
|
+
* @param opts - Options like `conversionAccuracy`.
|
|
651
|
+
*/
|
|
652
|
+
diff(other: LuxonJs["DateTime"], unit?: string | string[], opts?: {
|
|
653
|
+
conversionAccuracy?: "casual" | "longterm";
|
|
654
|
+
}): LuxonJs["Duration"];
|
|
655
|
+
/** The year represented by this DateTime instance */
|
|
656
|
+
year: number;
|
|
657
|
+
/** The month (1-12) represented by this DateTime instance */
|
|
658
|
+
month: number;
|
|
659
|
+
/** The day of the month (1-31) represented by this DateTime instance */
|
|
660
|
+
day: number;
|
|
661
|
+
/** The hour (0-23) represented by this DateTime instance */
|
|
662
|
+
hour: number;
|
|
663
|
+
/** The minute (0-59) represented by this DateTime instance */
|
|
664
|
+
minute: number;
|
|
665
|
+
/** The second (0-59) represented by this DateTime instance */
|
|
666
|
+
second: number;
|
|
667
|
+
/** The millisecond (0-999) represented by this DateTime instance */
|
|
668
|
+
millisecond: number;
|
|
669
|
+
/** The ISO week year represented by this DateTime instance */
|
|
670
|
+
weekYear: number;
|
|
671
|
+
/** The ISO week number (1-53) represented by this DateTime instance */
|
|
672
|
+
weekNumber: number;
|
|
673
|
+
/** The ISO weekday (1-7, where 1 is Monday) represented by this DateTime instance */
|
|
674
|
+
weekday: number;
|
|
675
|
+
/** The ordinal day of the year (1-365 or 1-366 for leap years) */
|
|
676
|
+
ordinal: number;
|
|
677
|
+
/** Indicates whether the DateTime instance is valid */
|
|
678
|
+
isValid: boolean;
|
|
679
|
+
/** The reason the DateTime instance is invalid, if applicable */
|
|
680
|
+
invalidReason: string | null;
|
|
681
|
+
/** Additional details about why the DateTime instance is invalid */
|
|
682
|
+
invalidExplanation: string | null;
|
|
683
|
+
/** The name of the time zone for this DateTime instance */
|
|
684
|
+
zoneName: string;
|
|
685
|
+
/** The locale used by this DateTime instance */
|
|
686
|
+
locale: string;
|
|
687
|
+
};
|
|
688
|
+
};
|
|
689
|
+
export {};
|
|
690
|
+
//# sourceMappingURL=date-time-objects.d.ts.map
|