nhb-toolbox 3.7.7 → 3.7.99
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/date/Chronos.d.ts +139 -129
- package/dist/date/Chronos.d.ts.map +1 -1
- package/dist/date/Chronos.js +307 -286
- package/dist/date/constants.d.ts +1 -0
- package/dist/date/constants.d.ts.map +1 -1
- package/dist/date/constants.js +1 -0
- package/dist/date/types.d.ts +14 -3
- package/dist/date/types.d.ts.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/object/convert.d.ts +27 -1
- package/dist/object/convert.d.ts.map +1 -1
- package/dist/object/convert.js +37 -0
- package/dist/object/types.d.ts +4 -0
- package/dist/object/types.d.ts.map +1 -1
- package/dist/types/index.d.ts +32 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +3 -2
package/dist/date/Chronos.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { LocaleCode } from '../number/types';
|
|
2
|
-
import
|
|
3
|
-
|
|
2
|
+
import { ORIGIN } from './constants';
|
|
3
|
+
import type { ChronosMethods, ChronosObject, FormatOptions, TimeUnit, TimeZone, UTCOffSet } from './types';
|
|
4
4
|
export declare class Chronos {
|
|
5
5
|
#private;
|
|
6
|
-
[ORIGIN]?:
|
|
6
|
+
[ORIGIN]?: ChronosMethods | 'root';
|
|
7
7
|
/**
|
|
8
8
|
* * Creates a new immutable `Chronos` instance.
|
|
9
9
|
*
|
|
@@ -15,73 +15,71 @@ export declare class Chronos {
|
|
|
15
15
|
*/
|
|
16
16
|
constructor(value?: number | string | Date | Chronos);
|
|
17
17
|
[Symbol.iterator](): IterableIterator<[string, number]>;
|
|
18
|
-
get [Symbol.toStringTag](): string;
|
|
19
18
|
/**
|
|
20
19
|
* * Enables primitive coercion like `console.log`, `${chronos}`, etc.
|
|
21
20
|
* @param hint - The type hint provided by the JS engine.
|
|
22
21
|
* @returns The primitive value based on the hint.
|
|
23
22
|
*/
|
|
24
23
|
[Symbol.toPrimitive](hint: string): string | number;
|
|
25
|
-
|
|
24
|
+
get [Symbol.toStringTag](): string;
|
|
25
|
+
/** Gets the full year of the date. */
|
|
26
|
+
get year(): number;
|
|
27
|
+
/** Gets the month (0-11) of the date. */
|
|
28
|
+
get month(): number;
|
|
29
|
+
/** Gets the day of the month (1-31). */
|
|
30
|
+
get date(): number;
|
|
31
|
+
/** Gets the day of the week (0-6, where 0 is Sunday). */
|
|
32
|
+
get weekDay(): number;
|
|
33
|
+
/** Gets the hour (0-23) of the date. */
|
|
34
|
+
get hour(): number;
|
|
35
|
+
/** Gets the minute (0-59) of the date. */
|
|
36
|
+
get minute(): number;
|
|
37
|
+
/** Gets the second (0-59) of the date. */
|
|
38
|
+
get second(): number;
|
|
39
|
+
/** Gets the millisecond (0-999) of the date. */
|
|
40
|
+
get millisecond(): number;
|
|
41
|
+
/** Gets ISO weekday: 1 = Monday, 7 = Sunday */
|
|
42
|
+
get isoWeekday(): number;
|
|
43
|
+
/** Gets ISO month (1–12 instead of 0–11) */
|
|
44
|
+
get isoMonth(): number;
|
|
45
|
+
/** Gets the time value in milliseconds since midnight, January 1, 1970 UTC. */
|
|
46
|
+
get unix(): number;
|
|
47
|
+
/** @public @instance Returns a debug-friendly string for console.log or util.inspect */
|
|
26
48
|
inspect(): string;
|
|
27
|
-
/**
|
|
49
|
+
/** @public @instance Clones and returns a new Chronos instance with the same date. */
|
|
28
50
|
clone(): Chronos;
|
|
29
|
-
/**
|
|
51
|
+
/** @public @instance Enables JSON.stringify and console logging to show readable output. */
|
|
30
52
|
toJSON(): string;
|
|
31
|
-
/**
|
|
53
|
+
/** @public @instance Enables arithmetic and comparison operations (e.g., +new Chronos()). */
|
|
32
54
|
valueOf(): number;
|
|
33
|
-
/**
|
|
55
|
+
/** @public @instance Gets the native `Date` instance (read-only). */
|
|
34
56
|
toDate(): Date;
|
|
35
|
-
/**
|
|
57
|
+
/** @public @instance Returns a string representation of a date. The format of the string depends on the locale. */
|
|
36
58
|
toString(): string;
|
|
37
|
-
/**
|
|
59
|
+
/** @public @instance Returns ISO string with local time zone offset */
|
|
38
60
|
toLocalISOString(): string;
|
|
39
|
-
/**
|
|
61
|
+
/** @public @instance Returns a date as a string value in ISO format. */
|
|
40
62
|
toISOString(): string;
|
|
41
63
|
/**
|
|
42
|
-
*
|
|
64
|
+
* @public @instance Wrapper over native `toLocaleString`
|
|
43
65
|
* @description Converts a date and time to a string by using the current or specified locale.
|
|
44
66
|
*
|
|
45
67
|
* @param locales A locale string, array of locale strings, Intl.Locale object, or array of Intl.Locale objects that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
|
|
46
68
|
* @param options An object that contains one or more properties that specify comparison options.
|
|
47
69
|
*/
|
|
48
70
|
toLocaleString(locale?: LocaleCode | Intl.Locale | (LocaleCode | Intl.Locale)[], options?: Intl.DateTimeFormatOptions): string;
|
|
49
|
-
/**
|
|
71
|
+
/** @public @instance Returns the time value in milliseconds since midnight, January 1, 1970 UTC. */
|
|
50
72
|
getTimeStamp(): number;
|
|
51
|
-
/** * Returns the time value in milliseconds since midnight, January 1, 1970 UTC. */
|
|
52
|
-
get unix(): number;
|
|
53
|
-
get year(): number;
|
|
54
|
-
get month(): number;
|
|
55
|
-
get date(): number;
|
|
56
|
-
get day(): number;
|
|
57
|
-
get hour(): number;
|
|
58
|
-
get minute(): number;
|
|
59
|
-
get second(): number;
|
|
60
|
-
get millisecond(): number;
|
|
61
|
-
/** * ISO weekday: 1 = Monday, 7 = Sunday */
|
|
62
|
-
get isoWeekday(): number;
|
|
63
73
|
/**
|
|
64
|
-
* @instance Returns the current date and time in a specified format in local time.
|
|
65
|
-
*
|
|
74
|
+
* @public @instance Returns the current date and time in a specified format in local time.
|
|
75
|
+
* @description Default format is dd, `MMM DD, YYYY HH:mm:ss` = `Sun, Apr 06, 2025 16:11:55:379`
|
|
76
|
+
*
|
|
66
77
|
* @param options - Configure format string and whether to format using utc offset.
|
|
67
78
|
* @returns Formatted date string in desired format.
|
|
68
79
|
*/
|
|
69
80
|
today(options?: FormatOptions): string;
|
|
70
81
|
/**
|
|
71
|
-
* @
|
|
72
|
-
* * Default format is dd, `MMM DD, YYYY HH:mm:ss` = `Sun, Apr 06, 2025 16:11:55:379`
|
|
73
|
-
* @param options - Configure format string and whether to format using utc offset.
|
|
74
|
-
* @returns Formatted date string in desired format.
|
|
75
|
-
*/
|
|
76
|
-
static today(options?: FormatOptions): string;
|
|
77
|
-
/**
|
|
78
|
-
* * Returns the number of milliseconds elapsed since midnight, January 1, 1970 Universal Coordinated Time (UTC).
|
|
79
|
-
* * It basically calls `Date.now()`.
|
|
80
|
-
* @returns The number of milliseconds elapsed since the Unix epoch.
|
|
81
|
-
*/
|
|
82
|
-
static now(): number;
|
|
83
|
-
/**
|
|
84
|
-
* * Formats the date into a custom string format (local time).
|
|
82
|
+
* @public @instance Formats the date into a custom string format (local time).
|
|
85
83
|
*
|
|
86
84
|
* @param format - The desired format (Default format is `dd, MMM DD, YYYY HH:mm:ss:mss` = `Sun, Apr 06, 2025 16:11:55:379`).
|
|
87
85
|
* @param useUTC - Optional `useUTC` to get the formatted time using UTC Offset, defaults to `false`. Equivalent to `formatUTC()` method if set to `true`.
|
|
@@ -89,76 +87,104 @@ export declare class Chronos {
|
|
|
89
87
|
*/
|
|
90
88
|
format(format?: string, useUTC?: boolean): string;
|
|
91
89
|
/**
|
|
92
|
-
*
|
|
90
|
+
* @public @instance Formats the date into a custom string format (UTC time).
|
|
93
91
|
*
|
|
94
92
|
* @param format - The desired format (Default format is `dd, MMM DD, YYYY HH:mm:ss:mss` = `Sun, Apr 06, 2025 16:11:55:379`).
|
|
95
93
|
* @returns Formatted date string in desired format (UTC time).
|
|
96
94
|
*/
|
|
97
95
|
formatUTC(format?: string): string;
|
|
98
96
|
/**
|
|
99
|
-
*
|
|
97
|
+
* @public @instance Adds seconds and returns a new immutable instance.
|
|
100
98
|
* @param seconds - Number of seconds to add.
|
|
101
99
|
* @returns A new `Chronos` instance with the updated date.
|
|
102
100
|
*/
|
|
103
101
|
addSeconds(seconds: number): Chronos;
|
|
104
102
|
/**
|
|
105
|
-
*
|
|
103
|
+
* @public @instance Adds minutes and returns a new immutable instance.
|
|
106
104
|
* @param minutes - Number of minutes to add.
|
|
107
105
|
* @returns A new `Chronos` instance with the updated date.
|
|
108
106
|
*/
|
|
109
107
|
addMinutes(minutes: number): Chronos;
|
|
110
108
|
/**
|
|
111
|
-
*
|
|
109
|
+
* @public @instance Adds hours and returns a new immutable instance.
|
|
112
110
|
* @param hours - Number of hours to add.
|
|
113
111
|
* @returns A new `Chronos` instance with the updated date.
|
|
114
112
|
*/
|
|
115
113
|
addHours(hours: number): Chronos;
|
|
116
114
|
/**
|
|
117
|
-
*
|
|
115
|
+
* @public @instance Adds days and returns a new immutable instance.
|
|
118
116
|
* @param days - Number of days to add.
|
|
119
117
|
* @returns A new `Chronos` instance with the updated date.
|
|
120
118
|
*/
|
|
121
119
|
addDays(days: number): Chronos;
|
|
122
120
|
/**
|
|
123
|
-
*
|
|
121
|
+
* @public @instance Adds months and returns a new immutable instance.
|
|
124
122
|
* @param months - Number of months to add.
|
|
125
123
|
* @returns A new `Chronos` instance with the updated date.
|
|
126
124
|
*/
|
|
127
125
|
addMonths(months: number): Chronos;
|
|
128
126
|
/**
|
|
129
|
-
*
|
|
127
|
+
* @public @instance Adds years and returns a new immutable instance.
|
|
130
128
|
* @param years - Number of years to add.
|
|
131
129
|
* @returns A new `Chronos` instance with the updated date.
|
|
132
130
|
*/
|
|
133
131
|
addYears(years: number): Chronos;
|
|
134
132
|
/**
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
* @
|
|
133
|
+
* @public @instance Create a new instance of `Chronos` in the specified timezone.
|
|
134
|
+
*
|
|
135
|
+
* @param zone - Standard timezone abbreviation (e.g., 'IST', 'UTC', 'EST') or UTC Offset in `UTC-01:30` format.
|
|
136
|
+
* @returns A new instance of `Chronos` with time in the given timezone. Invalid input sets time-zone to `UTC`.
|
|
138
137
|
*/
|
|
139
|
-
|
|
138
|
+
timeZone(zone: TimeZone | UTCOffSet): Chronos;
|
|
140
139
|
/**
|
|
141
|
-
*
|
|
140
|
+
* @public @instance Checks if the year is a leap year.
|
|
142
141
|
* - A year is a leap year if it is divisible by 4, but not divisible by 100, unless it is also divisible by 400.
|
|
143
142
|
* - For example, 2000 and 2400 are leap years, but 1900 and 2100 are not.
|
|
144
143
|
* @returns `true` if the year is a leap year, `false` otherwise.
|
|
145
144
|
*/
|
|
146
145
|
isLeapYear(): boolean;
|
|
147
|
-
/**
|
|
148
|
-
* * Create a new instance of `Chronos` in the specified timezone.
|
|
149
|
-
*
|
|
150
|
-
* @param zone - Standard timezone abbreviation (e.g., 'IST', 'UTC', 'EST') or UTC Offset in `UTC-01:30` format.
|
|
151
|
-
* @returns A new instance of `Chronos` with time in the given timezone. Invalid input sets time-zone to `UTC`.
|
|
152
|
-
*/
|
|
153
|
-
timeZone(zone: TimeZone | UTCOffSet): Chronos;
|
|
154
|
-
/** - Checks if the current date is today. */
|
|
146
|
+
/** @public @instance Checks if the current date is today. */
|
|
155
147
|
isToday(): boolean;
|
|
156
|
-
/**
|
|
148
|
+
/** @public @instance Checks if the current date is tomorrow. */
|
|
157
149
|
isTomorrow(): boolean;
|
|
158
|
-
/**
|
|
150
|
+
/** @public @instance Checks if the current date is yesterday. */
|
|
159
151
|
isYesterday(): boolean;
|
|
160
152
|
/**
|
|
161
|
-
*
|
|
153
|
+
* @public @instance Checks if another date is the same as this one in a specific unit.
|
|
154
|
+
* @param other The other date to compare.
|
|
155
|
+
* @param unit The unit to compare.
|
|
156
|
+
*/
|
|
157
|
+
isSame(other: number | string | Date | Chronos, unit: TimeUnit): boolean;
|
|
158
|
+
/**
|
|
159
|
+
* @public @instance Checks if this date is before another date in a specific unit.
|
|
160
|
+
* @param other The other date to compare.
|
|
161
|
+
* @param unit The unit to compare.
|
|
162
|
+
*/
|
|
163
|
+
isBefore(other: number | string | Date | Chronos, unit: TimeUnit): boolean;
|
|
164
|
+
/**
|
|
165
|
+
* @public @instance Checks if this date is after another date in a specific unit.
|
|
166
|
+
* @param other The other date to compare.
|
|
167
|
+
* @param unit The unit to compare.
|
|
168
|
+
*/
|
|
169
|
+
isAfter(other: number | string | Date | Chronos, unit: TimeUnit): boolean;
|
|
170
|
+
/**
|
|
171
|
+
* @public @instance Checks if the current date is between the given start and end dates.
|
|
172
|
+
*
|
|
173
|
+
* @param start - The start of the range.
|
|
174
|
+
* @param end - The end of the range.
|
|
175
|
+
* @param inclusive - Specifies whether the comparison is inclusive or exclusive:
|
|
176
|
+
* - `'[]'`: inclusive of both start and end (≥ start and ≤ end)
|
|
177
|
+
* - `'[)'`: inclusive of start, exclusive of end (≥ start and < end)
|
|
178
|
+
* - `'(]'`: exclusive of start, inclusive of end (> start and ≤ end)
|
|
179
|
+
* - `'()'`: exclusive of both start and end (> start and < end)
|
|
180
|
+
*
|
|
181
|
+
* @returns `true` if the current date is within the specified range based on the `inclusive` mode.
|
|
182
|
+
*/
|
|
183
|
+
isBetween(start: number | string | Date | Chronos, end: number | string | Date | Chronos, inclusive?: '[]' | '[)' | '(]' | '()'): boolean;
|
|
184
|
+
/** @public @instance Checks if currently in DST */
|
|
185
|
+
isDST(): boolean;
|
|
186
|
+
/**
|
|
187
|
+
* @public @instance Returns full time difference from now (or a specified time) down to a given level.
|
|
162
188
|
*
|
|
163
189
|
* @param level Determines the smallest unit to include in the output (e.g., 'minute' will show up to minutes, ignoring seconds). Defaults to `minute`.
|
|
164
190
|
* @param withSuffixPrefix If `true`, adds `"in"` or `"ago"` depending on whether the time is in the future or past. Defaults to `true`.
|
|
@@ -167,19 +193,19 @@ export declare class Chronos {
|
|
|
167
193
|
*/
|
|
168
194
|
fromNow(level?: Exclude<TimeUnit, 'millisecond'>, withSuffixPrefix?: boolean, time?: number | string | Date | Chronos): string;
|
|
169
195
|
/**
|
|
170
|
-
*
|
|
196
|
+
* @public @instance Returns the number of full years between the input date and now.
|
|
171
197
|
* @param time Optional time to compare with the `Chronos` date/time.
|
|
172
198
|
* @returns The difference in number, negative is `Chronos` time is a past time else positive.
|
|
173
199
|
*/
|
|
174
200
|
getRelativeYear(time?: number | string | Date | Chronos): number;
|
|
175
201
|
/**
|
|
176
|
-
*
|
|
202
|
+
* @public @instance Returns the number of full months between the input date and now.
|
|
177
203
|
* @param time Optional time to compare with the `Chronos` date/time.
|
|
178
204
|
* @returns The difference in number, negative is `Chronos` time is a past time else positive.
|
|
179
205
|
*/
|
|
180
206
|
getRelativeMonth(time?: number | string | Date | Chronos): number;
|
|
181
207
|
/**
|
|
182
|
-
*
|
|
208
|
+
* @public @instance Determines if the given date is today, tomorrow, yesterday or any relative day.
|
|
183
209
|
* @param date - The date to compare (Date object).
|
|
184
210
|
* @param time Optional time to compare with the `Chronos` date/time.
|
|
185
211
|
* @returns
|
|
@@ -190,31 +216,31 @@ export declare class Chronos {
|
|
|
190
216
|
*/
|
|
191
217
|
getRelativeDay(time?: number | string | Date | Chronos): number;
|
|
192
218
|
/**
|
|
193
|
-
*
|
|
219
|
+
* @public @instance Returns the number of full hours between the input date and now.
|
|
194
220
|
* @param time Optional time to compare with the `Chronos` date/time.
|
|
195
221
|
* @returns The difference in number, negative is `Chronos` time is a past time else positive.
|
|
196
222
|
*/
|
|
197
223
|
getRelativeHour(time?: number | string | Date | Chronos): number;
|
|
198
224
|
/**
|
|
199
|
-
*
|
|
225
|
+
* @public @instance Returns the number of full minutes between the input date and now.
|
|
200
226
|
* @param time Optional time to compare with the `Chronos` date/time.
|
|
201
227
|
* @returns The difference in number, negative is `Chronos` time is a past time else positive.
|
|
202
228
|
*/
|
|
203
229
|
getRelativeMinute(time?: number | string | Date | Chronos): number;
|
|
204
230
|
/**
|
|
205
|
-
*
|
|
231
|
+
* @public @instance Returns the number of full seconds between the input date and now.
|
|
206
232
|
* @param time Optional time to compare with the `Chronos` date/time.
|
|
207
233
|
* @returns The difference in number, negative is `Chronos` time is a past time else positive.
|
|
208
234
|
*/
|
|
209
235
|
getRelativeSecond(time?: number | string | Date | Chronos): number;
|
|
210
236
|
/**
|
|
211
|
-
*
|
|
237
|
+
* @public @instance Returns the number of milliseconds between the input date and now.
|
|
212
238
|
* @param time Optional time to compare with the `Chronos` date/time.
|
|
213
239
|
* @returns The difference in number, negative is `Chronos` time is a past time else positive.
|
|
214
240
|
*/
|
|
215
241
|
getRelativeMilliSecond(time?: number | string | Date | Chronos): number;
|
|
216
242
|
/**
|
|
217
|
-
*
|
|
243
|
+
* @public @instance Compares the stored date with now, returning the difference in the specified unit.
|
|
218
244
|
*
|
|
219
245
|
* @param unit The time unit to compare by. Defaults to 'minute'.
|
|
220
246
|
* @param time Optional time to compare with the `Chronos` date/time.
|
|
@@ -222,114 +248,98 @@ export declare class Chronos {
|
|
|
222
248
|
*/
|
|
223
249
|
compare(unit?: TimeUnit, time?: number | string | Date | Chronos): number;
|
|
224
250
|
/**
|
|
225
|
-
*
|
|
251
|
+
* @public @instance Returns a new Chronos instance at the start of a given unit.
|
|
226
252
|
* @param unit The unit to reset (e.g., year, month, day).
|
|
227
253
|
*/
|
|
228
254
|
startOf(unit: TimeUnit | 'week'): Chronos;
|
|
229
255
|
/**
|
|
230
|
-
*
|
|
256
|
+
* @public @instance Returns a new Chronos instance at the end of a given unit.
|
|
231
257
|
* @param unit The unit to adjust (e.g., year, month, day).
|
|
232
258
|
*/
|
|
233
259
|
endOf(unit: TimeUnit): Chronos;
|
|
234
260
|
/**
|
|
235
|
-
*
|
|
261
|
+
* @public @instance Returns a new Chronos instance with the specified unit added.
|
|
236
262
|
* @param amount The amount to add (can be negative).
|
|
237
263
|
* @param unit The time unit to add.
|
|
238
264
|
*/
|
|
239
265
|
add(amount: number, unit: TimeUnit): Chronos;
|
|
240
266
|
/**
|
|
241
|
-
*
|
|
267
|
+
* @public @instance Returns a new Chronos instance with the specified unit subtracted.
|
|
268
|
+
* @param amount The amount to subtract (can be negative).
|
|
269
|
+
* @param unit The time unit to add.
|
|
270
|
+
*/
|
|
271
|
+
subtract(amount: number, unit: TimeUnit): Chronos;
|
|
272
|
+
/**
|
|
273
|
+
* @public @instance Gets the value of a specific time unit from the date.
|
|
242
274
|
* @param unit The unit to retrieve.
|
|
243
275
|
*/
|
|
244
276
|
get(unit: TimeUnit): number;
|
|
245
277
|
/**
|
|
246
|
-
* Returns a new Chronos instance with the specified unit set to the given value.
|
|
278
|
+
* @public @instance Returns a new Chronos instance with the specified unit set to the given value.
|
|
247
279
|
* @param unit The unit to modify.
|
|
248
280
|
* @param value The value to set for the unit.
|
|
249
281
|
*/
|
|
250
282
|
set(unit: TimeUnit, value: number): Chronos;
|
|
251
283
|
/**
|
|
252
|
-
*
|
|
284
|
+
* @public @instance Returns the difference between this and another date in the given unit.
|
|
253
285
|
* @param other The other date to compare.
|
|
254
286
|
* @param unit The unit in which to return the difference.
|
|
255
287
|
*/
|
|
256
288
|
diff(other: number | string | Date | Chronos, unit: TimeUnit): number;
|
|
257
289
|
/**
|
|
258
|
-
*
|
|
259
|
-
* @param other The other date to compare.
|
|
260
|
-
* @param unit The unit to compare.
|
|
261
|
-
*/
|
|
262
|
-
isSame(other: number | string | Date | Chronos, unit: TimeUnit): boolean;
|
|
263
|
-
/**
|
|
264
|
-
* * Checks if this date is before another date in a specific unit.
|
|
265
|
-
* @param other The other date to compare.
|
|
266
|
-
* @param unit The unit to compare.
|
|
267
|
-
*/
|
|
268
|
-
isBefore(other: number | string | Date | Chronos, unit: TimeUnit): boolean;
|
|
269
|
-
/**
|
|
270
|
-
* * Checks if this date is after another date in a specific unit.
|
|
271
|
-
* @param other The other date to compare.
|
|
272
|
-
* @param unit The unit to compare.
|
|
273
|
-
*/
|
|
274
|
-
isAfter(other: number | string | Date | Chronos, unit: TimeUnit): boolean;
|
|
275
|
-
/**
|
|
276
|
-
* * Returns a human-readable relative calendar time like "Today at 3:00 PM"
|
|
290
|
+
* @public @instance Returns a human-readable relative calendar time like "Today at 3:00 PM"
|
|
277
291
|
* @param baseDate Optional base date to compare with.
|
|
278
292
|
*/
|
|
279
293
|
calendar(baseDate?: number | string | Date | Chronos): string;
|
|
280
|
-
/**
|
|
294
|
+
/** @public @instance Returns a short human-readable string like "2h ago", "in 5m" */
|
|
281
295
|
fromNowShort(): string;
|
|
282
|
-
/**
|
|
296
|
+
/** @public @instance Returns ISO week number */
|
|
283
297
|
getWeek(): number;
|
|
284
|
-
/**
|
|
298
|
+
/** @public @instance Returns ISO week year */
|
|
285
299
|
getWeekYear(): number;
|
|
286
|
-
/**
|
|
300
|
+
/** @public @instance Returns day of year (1 - 366) */
|
|
287
301
|
getDayOfYear(): number;
|
|
288
|
-
/**
|
|
289
|
-
* * Checks if the current date is between the given start and end dates.
|
|
290
|
-
*
|
|
291
|
-
* @param start - The start of the range.
|
|
292
|
-
* @param end - The end of the range.
|
|
293
|
-
* @param inclusive - Specifies whether the comparison is inclusive or exclusive:
|
|
294
|
-
* - `'[]'`: inclusive of both start and end (≥ start and ≤ end)
|
|
295
|
-
* - `'[)'`: inclusive of start, exclusive of end (≥ start and < end)
|
|
296
|
-
* - `'(]'`: exclusive of start, inclusive of end (> start and ≤ end)
|
|
297
|
-
* - `'()'`: exclusive of both start and end (> start and < end)
|
|
298
|
-
*
|
|
299
|
-
* @returns `true` if the current date is within the specified range based on the `inclusive` mode.
|
|
300
|
-
*/
|
|
301
|
-
isBetween(start: number | string | Date | Chronos, end: number | string | Date | Chronos, inclusive?: '[]' | '[)' | '(]' | '()'): boolean;
|
|
302
|
-
/** * Returns number of days in current month */
|
|
302
|
+
/** @public @instance Returns number of days in current month */
|
|
303
303
|
daysInMonth(): number;
|
|
304
|
-
/**
|
|
304
|
+
/** @public @instance Converts to object with all date unit parts */
|
|
305
305
|
toObject(): ChronosObject;
|
|
306
|
-
/**
|
|
306
|
+
/** @public @instance Converts to array with all date unit parts */
|
|
307
307
|
toArray(): any[];
|
|
308
|
-
/**
|
|
308
|
+
/** @public @instance Returns offset like +06:00 */
|
|
309
309
|
getUTCOffset(): string;
|
|
310
|
-
/**
|
|
311
|
-
isDST(): boolean;
|
|
312
|
-
/** * Returns new Chronos instance in UTC */
|
|
310
|
+
/** @public @instance Returns new Chronos instance in UTC */
|
|
313
311
|
toUTC(): Chronos;
|
|
314
|
-
/**
|
|
312
|
+
/** @public @instance Returns new Chronos instance in local time */
|
|
315
313
|
toLocal(): Chronos;
|
|
316
|
-
/**
|
|
314
|
+
/**
|
|
315
|
+
* @public @static Returns the current date and time in a specified format in local time.
|
|
316
|
+
* * Default format is dd, `MMM DD, YYYY HH:mm:ss` = `Sun, Apr 06, 2025 16:11:55:379`
|
|
317
|
+
* @param options - Configure format string and whether to format using utc offset.
|
|
318
|
+
* @returns Formatted date string in desired format.
|
|
319
|
+
*/
|
|
320
|
+
static today(options?: FormatOptions): string;
|
|
321
|
+
/**
|
|
322
|
+
* @public @static Returns the number of milliseconds elapsed since midnight, January 1, 1970 Universal Coordinated Time (UTC).
|
|
323
|
+
* * It basically calls `Date.now()`.
|
|
324
|
+
* @returns The number of milliseconds elapsed since the Unix epoch.
|
|
325
|
+
*/
|
|
326
|
+
static now(): number;
|
|
327
|
+
/** @public @static Parses a date string with a given format (partial support) */
|
|
317
328
|
static parse(dateStr: string, format: string): Chronos;
|
|
318
329
|
/**
|
|
319
|
-
* @static Creates UTC Chronos
|
|
330
|
+
* @public @static Creates UTC Chronos
|
|
320
331
|
* @param dateLike Date input to create utc time.
|
|
321
332
|
*/
|
|
322
333
|
static utc(dateLike: number | string | Date | Chronos): Chronos;
|
|
323
334
|
/**
|
|
324
|
-
* @static Returns earliest Chronos
|
|
335
|
+
* @public @static Returns earliest Chronos
|
|
325
336
|
* @param dates Date inputs.
|
|
326
337
|
*/
|
|
327
338
|
static min(...dates: (number | string | Date | Chronos)[]): Chronos;
|
|
328
339
|
/**
|
|
329
|
-
* @static Returns latest Chronos
|
|
340
|
+
* @public @static Returns latest Chronos
|
|
330
341
|
* @param dates Date inputs.
|
|
331
342
|
*/
|
|
332
343
|
static max(...dates: (number | string | Date | Chronos)[]): Chronos;
|
|
333
344
|
}
|
|
334
|
-
export {};
|
|
335
345
|
//# sourceMappingURL=Chronos.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chronos.d.ts","sourceRoot":"","sources":["../../src/date/Chronos.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"Chronos.d.ts","sourceRoot":"","sources":["../../src/date/Chronos.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAgB,MAAM,EAA6B,MAAM,aAAa,CAAC;AAE9E,OAAO,KAAK,EAEX,cAAc,EACd,aAAa,EACb,aAAa,EACb,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,MAAM,SAAS,CAAC;AAGjB,qBAAa,OAAO;;IAEnB,CAAC,MAAM,CAAC,CAAC,EAAE,cAAc,GAAG,MAAM,CAAC;IAEnC;;;;;;;;OAQG;gBACS,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,OAAO;IAOnD,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,gBAAgB,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAaxD;;;;OAIG;IACH,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM;IAKnD,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,MAAM,CAWjC;IA0HD,sCAAsC;IACtC,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,yCAAyC;IACzC,IAAI,KAAK,IAAI,MAAM,CAElB;IAED,wCAAwC;IACxC,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,yDA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