@ciwergrp/nuxid 1.6.2 → 1.6.3
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/module.json +1 -1
- package/docs/.docs/built-in-modules/element-plus.md +28 -0
- package/docs/.docs/built-in-modules/index.md +15 -0
- package/docs/.docs/built-in-modules/lodash.md +14 -0
- package/docs/.docs/built-in-modules/nuxt-icon.md +31 -0
- package/docs/.docs/built-in-modules/sentry.md +13 -0
- package/docs/.docs/built-in-modules/vueuse.md +28 -0
- package/docs/.docs/composables/use-breadcrumbs.md +53 -0
- package/docs/.docs/composables/use-cursor-http.md +56 -0
- package/docs/.docs/composables/use-http.md +57 -0
- package/docs/.docs/composables/use-pinia.md +65 -0
- package/docs/.docs/composables/use-query-filters.md +88 -0
- package/docs/.docs/composables/use-route-query.md +39 -0
- package/docs/.docs/composables/use-title.md +48 -0
- package/docs/.docs/composables/use-version-updater.md +38 -0
- package/docs/.docs/configuration.md +164 -0
- package/docs/.docs/form-validation/create-validation-rules.md +130 -0
- package/docs/.docs/form-validation/quick-start.md +67 -0
- package/docs/.docs/form-validation/request-generator.md +38 -0
- package/docs/.docs/form-validation/rules.md +418 -0
- package/docs/.docs/forms/use-form.md +58 -0
- package/docs/.docs/helpers/array.md +169 -0
- package/docs/.docs/helpers/date.md +702 -0
- package/docs/.docs/helpers/index.md +34 -0
- package/docs/.docs/helpers/number.md +169 -0
- package/docs/.docs/helpers/object.md +85 -0
- package/docs/.docs/helpers/string.md +316 -0
- package/docs/.docs/index.md +17 -0
- package/docs/.docs/structure-directory.md +28 -0
- package/package.json +3 -1
|
@@ -0,0 +1,702 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Date Helpers
|
|
3
|
+
outline: [2, 3]
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Date Helpers
|
|
7
|
+
|
|
8
|
+
Date helpers are available via `dt()` in factory style, or as prefixed functions (e.g. `Now()`, `DateFormat()`).
|
|
9
|
+
Most functions use `date-fns` and normalize input via `toDate()`.
|
|
10
|
+
|
|
11
|
+
Factory style:
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
const now = dt().now()
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Prefix style:
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
const now = Now()
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Methods
|
|
24
|
+
|
|
25
|
+
### dt
|
|
26
|
+
Summary: Factory accessor that returns the date helper object.
|
|
27
|
+
Parameters: none.
|
|
28
|
+
- Returns: `DateHelper`.
|
|
29
|
+
- Simple usage: `const d = dt().now()` = `new Date()`
|
|
30
|
+
- Advanced usage: `const formatted = dt().format('2024-01-01', 'YYYY-MM-DD')` = `'2024-01-01'`
|
|
31
|
+
|
|
32
|
+
### toDate
|
|
33
|
+
Summary: Normalizes input into a `Date` using parsing rules.
|
|
34
|
+
Parameters: `value` (Date | string | number).
|
|
35
|
+
- Returns: `Date`.
|
|
36
|
+
- Simple usage: `dt().toDate('2024-01-01')` = `new Date('2024-01-01T00:00:00.000Z')`
|
|
37
|
+
- Advanced usage: `dt().toDate('1704067200')` = `new Date('2024-01-01T00:00:00.000Z')`
|
|
38
|
+
|
|
39
|
+
### toUnix
|
|
40
|
+
Summary: Converts input to Unix seconds using `getTime()`.
|
|
41
|
+
Parameters: `value` (Date | string | number).
|
|
42
|
+
- Returns: `number`.
|
|
43
|
+
- Simple usage: `dt().toUnix('2024-01-01')` = `1704067200`
|
|
44
|
+
- Advanced usage: `dt().toUnix('2024-01-01T00:00:00Z')` = `1704067200`
|
|
45
|
+
|
|
46
|
+
### toMillis
|
|
47
|
+
Summary: Converts input to milliseconds using `getTime()`.
|
|
48
|
+
Parameters: `value` (Date | string | number).
|
|
49
|
+
- Returns: `number`.
|
|
50
|
+
- Simple usage: `dt().toMillis('2024-01-01')` = `1704067200000`
|
|
51
|
+
- Advanced usage: `dt().toMillis('2024-01-01T00:00:00Z')` = `1704067200000`
|
|
52
|
+
|
|
53
|
+
### fromUnix
|
|
54
|
+
Summary: Creates a `Date` from Unix seconds.
|
|
55
|
+
Parameters: `value` (number | string).
|
|
56
|
+
- Returns: `Date`.
|
|
57
|
+
- Simple usage: `dt().fromUnix(1704067200)` = `new Date('2024-01-01T00:00:00.000Z')`
|
|
58
|
+
- Advanced usage: `dt().fromUnix('1704067200')` = `new Date('2024-01-01T00:00:00.000Z')`
|
|
59
|
+
|
|
60
|
+
### fromTimestamp
|
|
61
|
+
Summary: Alias of `fromUnix` for timestamp seconds.
|
|
62
|
+
Parameters: `value` (number | string).
|
|
63
|
+
- Returns: `Date`.
|
|
64
|
+
- Simple usage: `dt().fromTimestamp(1704067200)` = `new Date('2024-01-01T00:00:00.000Z')`
|
|
65
|
+
- Advanced usage: `dt().fromTimestamp('1704067200')` = `new Date('2024-01-01T00:00:00.000Z')`
|
|
66
|
+
|
|
67
|
+
### now
|
|
68
|
+
Summary: Returns the current `Date`.
|
|
69
|
+
Parameters: none.
|
|
70
|
+
- Returns: `Date`.
|
|
71
|
+
- Simple usage: `dt().now()` = `new Date()`
|
|
72
|
+
- Advanced usage: `dt().now().toISOString()` = `'2024-01-01T00:00:00.000Z'`
|
|
73
|
+
|
|
74
|
+
### today
|
|
75
|
+
Summary: Returns start of today using `startOfToday`.
|
|
76
|
+
Parameters: none.
|
|
77
|
+
- Returns: `Date`.
|
|
78
|
+
- Simple usage: `dt().today().toISOString().slice(0, 10)` = `'2024-01-01'`
|
|
79
|
+
- Advanced usage: `dt().today().toISOString()` = `'2024-01-01T00:00:00.000Z'`
|
|
80
|
+
|
|
81
|
+
### tomorrow
|
|
82
|
+
Summary: Returns start of tomorrow using `startOfTomorrow`.
|
|
83
|
+
Parameters: none.
|
|
84
|
+
- Returns: `Date`.
|
|
85
|
+
- Simple usage: `dt().tomorrow().toISOString().slice(0, 10)` = `'2024-01-02'`
|
|
86
|
+
- Advanced usage: `dt().tomorrow().toISOString()` = `'2024-01-02T00:00:00.000Z'`
|
|
87
|
+
|
|
88
|
+
### yesterday
|
|
89
|
+
Summary: Returns start of yesterday using `startOfYesterday`.
|
|
90
|
+
Parameters: none.
|
|
91
|
+
- Returns: `Date`.
|
|
92
|
+
- Simple usage: `dt().yesterday().toISOString().slice(0, 10)` = `'2023-12-31'`
|
|
93
|
+
- Advanced usage: `dt().yesterday().toISOString()` = `'2023-12-31T00:00:00.000Z'`
|
|
94
|
+
|
|
95
|
+
### format
|
|
96
|
+
Summary: Formats a date using a preset map and `date-fns` `format`.
|
|
97
|
+
Parameters: `date` (Date | string | number), `formatString` (DateFormatPreset | string), `options` (FormatOptions, optional).
|
|
98
|
+
- Returns: `string`.
|
|
99
|
+
- Simple usage: `dt().format('2024-01-01', 'YYYY-MM-DD')` = `'2024-01-01'`
|
|
100
|
+
- Advanced usage: `dt().format('2024-01-01T00:00:00Z', 'YYYY-MM-DD HH:mm:ss')` = `'2024-01-01 00:00:00'`
|
|
101
|
+
|
|
102
|
+
### dateFormat
|
|
103
|
+
Summary: Prefix-style alias of `format` for non-factory usage.
|
|
104
|
+
Parameters: `date` (Date | string | number), `formatString` (DateFormatPreset | string), `options` (FormatOptions, optional).
|
|
105
|
+
- Returns: `string`.
|
|
106
|
+
- Simple usage: `DateFormat('2024-01-01', 'YYYY-MM-DD')` = `'2024-01-01'`
|
|
107
|
+
- Advanced usage: `DateFormat('2024-01-01T00:00:00Z', 'YYYY/MM/DD HH:mm')` = `'2024/01/01 00:00'`
|
|
108
|
+
|
|
109
|
+
### formatISO
|
|
110
|
+
Summary: Formats an ISO string using `date-fns` `formatISO`.
|
|
111
|
+
Parameters: `date` (Date | string | number), `options` (FormatISOOptions, optional).
|
|
112
|
+
- Returns: `string`.
|
|
113
|
+
- Simple usage: `dt().formatISO('2024-01-01')` = `'2024-01-01T00:00:00Z'`
|
|
114
|
+
- Advanced usage: `dt().formatISO('2024-01-01', { representation: 'date' })` = `'2024-01-01'`
|
|
115
|
+
|
|
116
|
+
### formatRFC3339
|
|
117
|
+
Summary: Formats an RFC3339 string using `date-fns`.
|
|
118
|
+
Parameters: `date` (Date | string | number), `options` (FormatRFC3339Options, optional).
|
|
119
|
+
- Returns: `string`.
|
|
120
|
+
- Simple usage: `dt().formatRFC3339('2024-01-01')` = `'2024-01-01T00:00:00Z'`
|
|
121
|
+
- Advanced usage: `dt().formatRFC3339('2024-01-01', { fractionDigits: 3 })` = `'2024-01-01T00:00:00.000Z'`
|
|
122
|
+
|
|
123
|
+
### formatRFC7231
|
|
124
|
+
Summary: Formats an RFC7231 string using `date-fns`.
|
|
125
|
+
Parameters: `date` (Date | string | number).
|
|
126
|
+
- Returns: `string`.
|
|
127
|
+
- Simple usage: `dt().formatRFC7231('2024-01-01')` = `'Mon, 01 Jan 2024 00:00:00 GMT'`
|
|
128
|
+
- Advanced usage: `dt().formatRFC7231('2024-01-01T00:00:00Z')` = `'Mon, 01 Jan 2024 00:00:00 GMT'`
|
|
129
|
+
|
|
130
|
+
### fromNow
|
|
131
|
+
Summary: Produces a relative time string from now.
|
|
132
|
+
Parameters: `date` (Date | string | number), `options` (FormatDistanceToNowOptions, optional).
|
|
133
|
+
- Returns: `string`.
|
|
134
|
+
- Simple usage: `dt().fromNow('2024-01-01')` = `'in about 1 hour'`
|
|
135
|
+
- Advanced usage: `dt().fromNow('2024-01-01T00:00:30Z', { includeSeconds: true })` = `'less than a minute'`
|
|
136
|
+
|
|
137
|
+
### diffForHumans
|
|
138
|
+
Summary: Produces a relative time string between two dates.
|
|
139
|
+
Parameters: `date` (Date | string | number), `baseDate` (Date | string | number, optional), `options` (FormatDistanceOptions, optional).
|
|
140
|
+
- Returns: `string`.
|
|
141
|
+
- Simple usage: `dt().diffForHumans('2024-01-01')` = `'about 1 month'`
|
|
142
|
+
- Advanced usage: `dt().diffForHumans('2024-01-01', '2024-02-01')` = `'about 1 month'`
|
|
143
|
+
|
|
144
|
+
### toDateString
|
|
145
|
+
Summary: Formats as `YYYY-MM-DD`.
|
|
146
|
+
Parameters: `date` (Date | string | number).
|
|
147
|
+
- Returns: `string`.
|
|
148
|
+
- Simple usage: `dt().toDateString('2024-01-01T10:00:00Z')` = `'2024-01-01'`
|
|
149
|
+
- Advanced usage: `dt().toDateString('2024-01-01T00:00:00Z')` = `'2024-01-01'`
|
|
150
|
+
|
|
151
|
+
### toTimeString
|
|
152
|
+
Summary: Formats as `HH:mm:ss`.
|
|
153
|
+
Parameters: `date` (Date | string | number).
|
|
154
|
+
- Returns: `string`.
|
|
155
|
+
- Simple usage: `dt().toTimeString('2024-01-01T10:00:00Z')` = `'10:00:00'`
|
|
156
|
+
- Advanced usage: `dt().toTimeString('2024-01-01T00:00:00Z')` = `'00:00:00'`
|
|
157
|
+
|
|
158
|
+
### toDateTimeString
|
|
159
|
+
Summary: Formats as `YYYY-MM-DD HH:mm:ss`.
|
|
160
|
+
Parameters: `date` (Date | string | number).
|
|
161
|
+
- Returns: `string`.
|
|
162
|
+
- Simple usage: `dt().toDateTimeString('2024-01-01T10:00:00Z')` = `'2024-01-01 10:00:00'`
|
|
163
|
+
- Advanced usage: `dt().toDateTimeString('2024-01-01T00:00:00Z')` = `'2024-01-01 00:00:00'`
|
|
164
|
+
|
|
165
|
+
### toIsoString
|
|
166
|
+
Summary: Formats as ISO string using `formatISO`.
|
|
167
|
+
Parameters: `date` (Date | string | number).
|
|
168
|
+
- Returns: `string`.
|
|
169
|
+
- Simple usage: `dt().toIsoString('2024-01-01')` = `'2024-01-01T00:00:00Z'`
|
|
170
|
+
- Advanced usage: `dt().toIsoString('2024-01-01T00:00:00Z')` = `'2024-01-01T00:00:00Z'`
|
|
171
|
+
|
|
172
|
+
### toRfc3339String
|
|
173
|
+
Summary: Formats as RFC3339 string.
|
|
174
|
+
Parameters: `date` (Date | string | number).
|
|
175
|
+
- Returns: `string`.
|
|
176
|
+
- Simple usage: `dt().toRfc3339String('2024-01-01')` = `'2024-01-01T00:00:00Z'`
|
|
177
|
+
- Advanced usage: `dt().toRfc3339String('2024-01-01T00:00:00Z')` = `'2024-01-01T00:00:00Z'`
|
|
178
|
+
|
|
179
|
+
### toRfc7231String
|
|
180
|
+
Summary: Formats as RFC7231 string.
|
|
181
|
+
Parameters: `date` (Date | string | number).
|
|
182
|
+
- Returns: `string`.
|
|
183
|
+
- Simple usage: `dt().toRfc7231String('2024-01-01')` = `'Mon, 01 Jan 2024 00:00:00 GMT'`
|
|
184
|
+
- Advanced usage: `dt().toRfc7231String('2024-01-01T00:00:00Z')` = `'Mon, 01 Jan 2024 00:00:00 GMT'`
|
|
185
|
+
|
|
186
|
+
### parse
|
|
187
|
+
Summary: Parses a string using a format preset and base date.
|
|
188
|
+
Parameters: `value` (string), `formatString` (DateFormatPreset | string), `baseDate` (Date | string | number, optional), `options` (ParseOptions, optional).
|
|
189
|
+
- Returns: `Date`.
|
|
190
|
+
- Simple usage: `dt().parse('2024-01-01', 'YYYY-MM-DD')` = `new Date('2024-01-01T00:00:00.000Z')`
|
|
191
|
+
- Advanced usage: `dt().parse('01/02/2024', 'DD/MM/YYYY', new Date('2024-01-01'))` = `new Date('2024-02-01T00:00:00.000Z')`
|
|
192
|
+
|
|
193
|
+
### dateParse
|
|
194
|
+
Summary: Prefix-style alias of `parse` for non-factory usage.
|
|
195
|
+
Parameters: `value` (string), `formatString` (DateFormatPreset | string), `baseDate` (Date | string | number, optional), `options` (ParseOptions, optional).
|
|
196
|
+
- Returns: `Date`.
|
|
197
|
+
- Simple usage: `DateParse('2024-01-01', 'YYYY-MM-DD')` = `new Date('2024-01-01T00:00:00.000Z')`
|
|
198
|
+
- Advanced usage: `DateParse('01/02/2024', 'DD/MM/YYYY', new Date('2024-01-01'))` = `new Date('2024-02-01T00:00:00.000Z')`
|
|
199
|
+
|
|
200
|
+
### parseISO
|
|
201
|
+
Summary: Parses ISO strings using `date-fns` `parseISO`.
|
|
202
|
+
Parameters: `value` (string).
|
|
203
|
+
- Returns: `Date`.
|
|
204
|
+
- Simple usage: `dt().parseISO('2024-01-01')` = `new Date('2024-01-01T00:00:00.000Z')`
|
|
205
|
+
- Advanced usage: `dt().parseISO('2024-01-01T10:00:00Z')` = `new Date('2024-01-01T10:00:00.000Z')`
|
|
206
|
+
|
|
207
|
+
### addSeconds
|
|
208
|
+
Summary: Adds seconds using `date-fns` `addSeconds`.
|
|
209
|
+
Parameters: `date` (Date | string | number), `amount` (number).
|
|
210
|
+
- Returns: `Date`.
|
|
211
|
+
- Simple usage: `dt().addSeconds('2024-01-01T00:00:00Z', 30)` = `new Date('2024-01-01T00:00:30.000Z')`
|
|
212
|
+
- Advanced usage: `dt().addSeconds('2024-01-01T00:00:00Z', 120)` = `new Date('2024-01-01T00:02:00.000Z')`
|
|
213
|
+
|
|
214
|
+
### addSecond
|
|
215
|
+
Summary: Adds one second via `addSeconds`.
|
|
216
|
+
Parameters: `date` (Date | string | number).
|
|
217
|
+
- Returns: `Date`.
|
|
218
|
+
- Simple usage: `dt().addSecond('2024-01-01T00:00:00Z')` = `new Date('2024-01-01T00:00:01.000Z')`
|
|
219
|
+
- Advanced usage: `dt().addSecond('2024-01-01T00:00:00Z')` = `new Date('2024-01-01T00:00:01.000Z')`
|
|
220
|
+
|
|
221
|
+
### addMinutes
|
|
222
|
+
Summary: Adds minutes using `date-fns` `addMinutes`.
|
|
223
|
+
Parameters: `date` (Date | string | number), `amount` (number).
|
|
224
|
+
- Returns: `Date`.
|
|
225
|
+
- Simple usage: `dt().addMinutes('2024-01-01T00:00:00Z', 15)` = `new Date('2024-01-01T00:15:00.000Z')`
|
|
226
|
+
- Advanced usage: `dt().addMinutes('2024-01-01T00:00:00Z', 90)` = `new Date('2024-01-01T01:30:00.000Z')`
|
|
227
|
+
|
|
228
|
+
### addMinute
|
|
229
|
+
Summary: Adds one minute via `addMinutes`.
|
|
230
|
+
Parameters: `date` (Date | string | number).
|
|
231
|
+
- Returns: `Date`.
|
|
232
|
+
- Simple usage: `dt().addMinute('2024-01-01T00:00:00Z')` = `new Date('2024-01-01T00:01:00.000Z')`
|
|
233
|
+
- Advanced usage: `dt().addMinute('2024-01-01T00:00:00Z')` = `new Date('2024-01-01T00:01:00.000Z')`
|
|
234
|
+
|
|
235
|
+
### addHours
|
|
236
|
+
Summary: Adds hours using `date-fns` `addHours`.
|
|
237
|
+
Parameters: `date` (Date | string | number), `amount` (number).
|
|
238
|
+
- Returns: `Date`.
|
|
239
|
+
- Simple usage: `dt().addHours('2024-01-01T00:00:00Z', 2)` = `new Date('2024-01-01T02:00:00.000Z')`
|
|
240
|
+
- Advanced usage: `dt().addHours('2024-01-01T00:00:00Z', 6)` = `new Date('2024-01-01T06:00:00.000Z')`
|
|
241
|
+
|
|
242
|
+
### addHour
|
|
243
|
+
Summary: Adds one hour via `addHours`.
|
|
244
|
+
Parameters: `date` (Date | string | number).
|
|
245
|
+
- Returns: `Date`.
|
|
246
|
+
- Simple usage: `dt().addHour('2024-01-01T00:00:00Z')` = `new Date('2024-01-01T01:00:00.000Z')`
|
|
247
|
+
- Advanced usage: `dt().addHour('2024-01-01T00:00:00Z')` = `new Date('2024-01-01T01:00:00.000Z')`
|
|
248
|
+
|
|
249
|
+
### addDays
|
|
250
|
+
Summary: Adds days using `date-fns` `addDays`.
|
|
251
|
+
Parameters: `date` (Date | string | number), `amount` (number).
|
|
252
|
+
- Returns: `Date`.
|
|
253
|
+
- Simple usage: `dt().addDays('2024-01-01', 7)` = `new Date('2024-01-08T00:00:00.000Z')`
|
|
254
|
+
- Advanced usage: `dt().addDays('2024-01-01', 30)` = `new Date('2024-01-31T00:00:00.000Z')`
|
|
255
|
+
|
|
256
|
+
### addDay
|
|
257
|
+
Summary: Adds one day via `addDays`.
|
|
258
|
+
Parameters: `date` (Date | string | number).
|
|
259
|
+
- Returns: `Date`.
|
|
260
|
+
- Simple usage: `dt().addDay('2024-01-01')` = `new Date('2024-01-02T00:00:00.000Z')`
|
|
261
|
+
- Advanced usage: `dt().addDay('2024-01-01')` = `new Date('2024-01-02T00:00:00.000Z')`
|
|
262
|
+
|
|
263
|
+
### addWeeks
|
|
264
|
+
Summary: Adds weeks using `date-fns` `addWeeks`.
|
|
265
|
+
Parameters: `date` (Date | string | number), `amount` (number).
|
|
266
|
+
- Returns: `Date`.
|
|
267
|
+
- Simple usage: `dt().addWeeks('2024-01-01', 2)` = `new Date('2024-01-15T00:00:00.000Z')`
|
|
268
|
+
- Advanced usage: `dt().addWeeks('2024-01-01', 4)` = `new Date('2024-01-29T00:00:00.000Z')`
|
|
269
|
+
|
|
270
|
+
### addWeek
|
|
271
|
+
Summary: Adds one week via `addWeeks`.
|
|
272
|
+
Parameters: `date` (Date | string | number).
|
|
273
|
+
- Returns: `Date`.
|
|
274
|
+
- Simple usage: `dt().addWeek('2024-01-01')` = `new Date('2024-01-08T00:00:00.000Z')`
|
|
275
|
+
- Advanced usage: `dt().addWeek('2024-01-01')` = `new Date('2024-01-08T00:00:00.000Z')`
|
|
276
|
+
|
|
277
|
+
### addMonths
|
|
278
|
+
Summary: Adds months using `date-fns` `addMonths`.
|
|
279
|
+
Parameters: `date` (Date | string | number), `amount` (number).
|
|
280
|
+
- Returns: `Date`.
|
|
281
|
+
- Simple usage: `dt().addMonths('2024-01-01', 1)` = `new Date('2024-02-01T00:00:00.000Z')`
|
|
282
|
+
- Advanced usage: `dt().addMonths('2024-01-01', 6)` = `new Date('2024-07-01T00:00:00.000Z')`
|
|
283
|
+
|
|
284
|
+
### addMonth
|
|
285
|
+
Summary: Adds one month via `addMonths`.
|
|
286
|
+
Parameters: `date` (Date | string | number).
|
|
287
|
+
- Returns: `Date`.
|
|
288
|
+
- Simple usage: `dt().addMonth('2024-01-01')` = `new Date('2024-02-01T00:00:00.000Z')`
|
|
289
|
+
- Advanced usage: `dt().addMonth('2024-01-01')` = `new Date('2024-02-01T00:00:00.000Z')`
|
|
290
|
+
|
|
291
|
+
### addYears
|
|
292
|
+
Summary: Adds years using `date-fns` `addYears`.
|
|
293
|
+
Parameters: `date` (Date | string | number), `amount` (number).
|
|
294
|
+
- Returns: `Date`.
|
|
295
|
+
- Simple usage: `dt().addYears('2024-01-01', 1)` = `new Date('2025-01-01T00:00:00.000Z')`
|
|
296
|
+
- Advanced usage: `dt().addYears('2024-01-01', 5)` = `new Date('2029-01-01T00:00:00.000Z')`
|
|
297
|
+
|
|
298
|
+
### addYear
|
|
299
|
+
Summary: Adds one year via `addYears`.
|
|
300
|
+
Parameters: `date` (Date | string | number).
|
|
301
|
+
- Returns: `Date`.
|
|
302
|
+
- Simple usage: `dt().addYear('2024-01-01')` = `new Date('2025-01-01T00:00:00.000Z')`
|
|
303
|
+
- Advanced usage: `dt().addYear('2024-01-01')` = `new Date('2025-01-01T00:00:00.000Z')`
|
|
304
|
+
|
|
305
|
+
### subSeconds
|
|
306
|
+
Summary: Subtracts seconds using `date-fns` `subSeconds`.
|
|
307
|
+
Parameters: `date` (Date | string | number), `amount` (number).
|
|
308
|
+
- Returns: `Date`.
|
|
309
|
+
- Simple usage: `dt().subSeconds('2024-01-01T00:01:00Z', 30)` = `new Date('2024-01-01T00:00:30.000Z')`
|
|
310
|
+
- Advanced usage: `dt().subSeconds('2024-01-01T00:02:00Z', 120)` = `new Date('2024-01-01T00:00:00.000Z')`
|
|
311
|
+
|
|
312
|
+
### subSecond
|
|
313
|
+
Summary: Subtracts one second via `subSeconds`.
|
|
314
|
+
Parameters: `date` (Date | string | number).
|
|
315
|
+
- Returns: `Date`.
|
|
316
|
+
- Simple usage: `dt().subSecond('2024-01-01T00:00:00Z')` = `new Date('2023-12-31T23:59:59.000Z')`
|
|
317
|
+
- Advanced usage: `dt().subSecond('2024-01-01T00:00:00Z')` = `new Date('2023-12-31T23:59:59.000Z')`
|
|
318
|
+
|
|
319
|
+
### subMinutes
|
|
320
|
+
Summary: Subtracts minutes using `date-fns` `subMinutes`.
|
|
321
|
+
Parameters: `date` (Date | string | number), `amount` (number).
|
|
322
|
+
- Returns: `Date`.
|
|
323
|
+
- Simple usage: `dt().subMinutes('2024-01-01T01:00:00Z', 15)` = `new Date('2024-01-01T00:45:00.000Z')`
|
|
324
|
+
- Advanced usage: `dt().subMinutes('2024-01-01T01:30:00Z', 90)` = `new Date('2024-01-01T00:00:00.000Z')`
|
|
325
|
+
|
|
326
|
+
### subMinute
|
|
327
|
+
Summary: Subtracts one minute via `subMinutes`.
|
|
328
|
+
Parameters: `date` (Date | string | number).
|
|
329
|
+
- Returns: `Date`.
|
|
330
|
+
- Simple usage: `dt().subMinute('2024-01-01T00:00:00Z')` = `new Date('2023-12-31T23:59:00.000Z')`
|
|
331
|
+
- Advanced usage: `dt().subMinute('2024-01-01T00:00:00Z')` = `new Date('2023-12-31T23:59:00.000Z')`
|
|
332
|
+
|
|
333
|
+
### subHours
|
|
334
|
+
Summary: Subtracts hours using `date-fns` `subHours`.
|
|
335
|
+
Parameters: `date` (Date | string | number), `amount` (number).
|
|
336
|
+
- Returns: `Date`.
|
|
337
|
+
- Simple usage: `dt().subHours('2024-01-01T12:00:00Z', 2)` = `new Date('2024-01-01T10:00:00.000Z')`
|
|
338
|
+
- Advanced usage: `dt().subHours('2024-01-01T06:00:00Z', 6)` = `new Date('2024-01-01T00:00:00.000Z')`
|
|
339
|
+
|
|
340
|
+
### subHour
|
|
341
|
+
Summary: Subtracts one hour via `subHours`.
|
|
342
|
+
Parameters: `date` (Date | string | number).
|
|
343
|
+
- Returns: `Date`.
|
|
344
|
+
- Simple usage: `dt().subHour('2024-01-01T00:00:00Z')` = `new Date('2023-12-31T23:00:00.000Z')`
|
|
345
|
+
- Advanced usage: `dt().subHour('2024-01-01T00:00:00Z')` = `new Date('2023-12-31T23:00:00.000Z')`
|
|
346
|
+
|
|
347
|
+
### subDays
|
|
348
|
+
Summary: Subtracts days using `date-fns` `subDays`.
|
|
349
|
+
Parameters: `date` (Date | string | number), `amount` (number).
|
|
350
|
+
- Returns: `Date`.
|
|
351
|
+
- Simple usage: `dt().subDays('2024-01-01', 7)` = `new Date('2023-12-25T00:00:00.000Z')`
|
|
352
|
+
- Advanced usage: `dt().subDays('2024-01-01', 30)` = `new Date('2023-12-02T00:00:00.000Z')`
|
|
353
|
+
|
|
354
|
+
### subDay
|
|
355
|
+
Summary: Subtracts one day via `subDays`.
|
|
356
|
+
Parameters: `date` (Date | string | number).
|
|
357
|
+
- Returns: `Date`.
|
|
358
|
+
- Simple usage: `dt().subDay('2024-01-01')` = `new Date('2023-12-31T00:00:00.000Z')`
|
|
359
|
+
- Advanced usage: `dt().subDay('2024-01-01')` = `new Date('2023-12-31T00:00:00.000Z')`
|
|
360
|
+
|
|
361
|
+
### subWeeks
|
|
362
|
+
Summary: Subtracts weeks using `date-fns` `subWeeks`.
|
|
363
|
+
Parameters: `date` (Date | string | number), `amount` (number).
|
|
364
|
+
- Returns: `Date`.
|
|
365
|
+
- Simple usage: `dt().subWeeks('2024-01-01', 2)` = `new Date('2023-12-18T00:00:00.000Z')`
|
|
366
|
+
- Advanced usage: `dt().subWeeks('2024-01-01', 4)` = `new Date('2023-12-04T00:00:00.000Z')`
|
|
367
|
+
|
|
368
|
+
### subWeek
|
|
369
|
+
Summary: Subtracts one week via `subWeeks`.
|
|
370
|
+
Parameters: `date` (Date | string | number).
|
|
371
|
+
- Returns: `Date`.
|
|
372
|
+
- Simple usage: `dt().subWeek('2024-01-01')` = `new Date('2023-12-25T00:00:00.000Z')`
|
|
373
|
+
- Advanced usage: `dt().subWeek('2024-01-01')` = `new Date('2023-12-25T00:00:00.000Z')`
|
|
374
|
+
|
|
375
|
+
### subMonths
|
|
376
|
+
Summary: Subtracts months using `date-fns` `subMonths`.
|
|
377
|
+
Parameters: `date` (Date | string | number), `amount` (number).
|
|
378
|
+
- Returns: `Date`.
|
|
379
|
+
- Simple usage: `dt().subMonths('2024-01-01', 1)` = `new Date('2023-12-01T00:00:00.000Z')`
|
|
380
|
+
- Advanced usage: `dt().subMonths('2024-01-01', 6)` = `new Date('2023-07-01T00:00:00.000Z')`
|
|
381
|
+
|
|
382
|
+
### subMonth
|
|
383
|
+
Summary: Subtracts one month via `subMonths`.
|
|
384
|
+
Parameters: `date` (Date | string | number).
|
|
385
|
+
- Returns: `Date`.
|
|
386
|
+
- Simple usage: `dt().subMonth('2024-01-01')` = `new Date('2023-12-01T00:00:00.000Z')`
|
|
387
|
+
- Advanced usage: `dt().subMonth('2024-01-01')` = `new Date('2023-12-01T00:00:00.000Z')`
|
|
388
|
+
|
|
389
|
+
### subYears
|
|
390
|
+
Summary: Subtracts years using `date-fns` `subYears`.
|
|
391
|
+
Parameters: `date` (Date | string | number), `amount` (number).
|
|
392
|
+
- Returns: `Date`.
|
|
393
|
+
- Simple usage: `dt().subYears('2024-01-01', 1)` = `new Date('2023-01-01T00:00:00.000Z')`
|
|
394
|
+
- Advanced usage: `dt().subYears('2024-01-01', 5)` = `new Date('2019-01-01T00:00:00.000Z')`
|
|
395
|
+
|
|
396
|
+
### subYear
|
|
397
|
+
Summary: Subtracts one year via `subYears`.
|
|
398
|
+
Parameters: `date` (Date | string | number).
|
|
399
|
+
- Returns: `Date`.
|
|
400
|
+
- Simple usage: `dt().subYear('2024-01-01')` = `new Date('2023-01-01T00:00:00.000Z')`
|
|
401
|
+
- Advanced usage: `dt().subYear('2024-01-01')` = `new Date('2023-01-01T00:00:00.000Z')`
|
|
402
|
+
|
|
403
|
+
### startOfSecond
|
|
404
|
+
Summary: Returns the start of the second.
|
|
405
|
+
Parameters: `date` (Date | string | number).
|
|
406
|
+
- Returns: `Date`.
|
|
407
|
+
- Simple usage: `dt().startOfSecond('2024-01-01T00:00:00.999Z')` = `new Date('2024-01-01T00:00:00.000Z')`
|
|
408
|
+
- Advanced usage: `dt().startOfSecond('2024-01-01T00:00:00.999Z')` = `new Date('2024-01-01T00:00:00.000Z')`
|
|
409
|
+
|
|
410
|
+
### endOfSecond
|
|
411
|
+
Summary: Returns the end of the second.
|
|
412
|
+
Parameters: `date` (Date | string | number).
|
|
413
|
+
- Returns: `Date`.
|
|
414
|
+
- Simple usage: `dt().endOfSecond('2024-01-01T00:00:00.001Z')` = `new Date('2024-01-01T00:00:00.999Z')`
|
|
415
|
+
- Advanced usage: `dt().endOfSecond('2024-01-01T00:00:00.001Z')` = `new Date('2024-01-01T00:00:00.999Z')`
|
|
416
|
+
|
|
417
|
+
### startOfMinute
|
|
418
|
+
Summary: Returns the start of the minute.
|
|
419
|
+
Parameters: `date` (Date | string | number).
|
|
420
|
+
- Returns: `Date`.
|
|
421
|
+
- Simple usage: `dt().startOfMinute('2024-01-01T00:00:59.999Z')` = `new Date('2024-01-01T00:00:00.000Z')`
|
|
422
|
+
- Advanced usage: `dt().startOfMinute('2024-01-01T00:00:59.999Z')` = `new Date('2024-01-01T00:00:00.000Z')`
|
|
423
|
+
|
|
424
|
+
### endOfMinute
|
|
425
|
+
Summary: Returns the end of the minute.
|
|
426
|
+
Parameters: `date` (Date | string | number).
|
|
427
|
+
- Returns: `Date`.
|
|
428
|
+
- Simple usage: `dt().endOfMinute('2024-01-01T00:00:00.001Z')` = `new Date('2024-01-01T00:00:59.999Z')`
|
|
429
|
+
- Advanced usage: `dt().endOfMinute('2024-01-01T00:00:00.001Z')` = `new Date('2024-01-01T00:00:59.999Z')`
|
|
430
|
+
|
|
431
|
+
### startOfHour
|
|
432
|
+
Summary: Returns the start of the hour.
|
|
433
|
+
Parameters: `date` (Date | string | number).
|
|
434
|
+
- Returns: `Date`.
|
|
435
|
+
- Simple usage: `dt().startOfHour('2024-01-01T23:59:59.999Z')` = `new Date('2024-01-01T23:00:00.000Z')`
|
|
436
|
+
- Advanced usage: `dt().startOfHour('2024-01-01T23:59:59.999Z')` = `new Date('2024-01-01T23:00:00.000Z')`
|
|
437
|
+
|
|
438
|
+
### endOfHour
|
|
439
|
+
Summary: Returns the end of the hour.
|
|
440
|
+
Parameters: `date` (Date | string | number).
|
|
441
|
+
- Returns: `Date`.
|
|
442
|
+
- Simple usage: `dt().endOfHour('2024-01-01T00:00:00.001Z')` = `new Date('2024-01-01T00:59:59.999Z')`
|
|
443
|
+
- Advanced usage: `dt().endOfHour('2024-01-01T00:00:00.001Z')` = `new Date('2024-01-01T00:59:59.999Z')`
|
|
444
|
+
|
|
445
|
+
### startOfDay
|
|
446
|
+
Summary: Returns the start of the day.
|
|
447
|
+
Parameters: `date` (Date | string | number).
|
|
448
|
+
- Returns: `Date`.
|
|
449
|
+
- Simple usage: `dt().startOfDay('2024-01-01T23:59:59.999Z')` = `new Date('2024-01-01T00:00:00.000Z')`
|
|
450
|
+
- Advanced usage: `dt().startOfDay('2024-01-01T23:59:59.999Z')` = `new Date('2024-01-01T00:00:00.000Z')`
|
|
451
|
+
|
|
452
|
+
### endOfDay
|
|
453
|
+
Summary: Returns the end of the day.
|
|
454
|
+
Parameters: `date` (Date | string | number).
|
|
455
|
+
- Returns: `Date`.
|
|
456
|
+
- Simple usage: `dt().endOfDay('2024-01-01T00:00:00.001Z')` = `new Date('2024-01-01T23:59:59.999Z')`
|
|
457
|
+
- Advanced usage: `dt().endOfDay('2024-01-01T00:00:00.001Z')` = `new Date('2024-01-01T23:59:59.999Z')`
|
|
458
|
+
|
|
459
|
+
### startOfWeek
|
|
460
|
+
Summary: Returns the start of the week.
|
|
461
|
+
Parameters: `date` (Date | string | number).
|
|
462
|
+
- Returns: `Date`.
|
|
463
|
+
- Simple usage: `dt().startOfWeek('2024-01-01')` = `new Date('2023-12-31T00:00:00.000Z')`
|
|
464
|
+
- Advanced usage: `dt().startOfWeek('2024-01-01')` = `new Date('2023-12-31T00:00:00.000Z')`
|
|
465
|
+
|
|
466
|
+
### endOfWeek
|
|
467
|
+
Summary: Returns the end of the week.
|
|
468
|
+
Parameters: `date` (Date | string | number).
|
|
469
|
+
- Returns: `Date`.
|
|
470
|
+
- Simple usage: `dt().endOfWeek('2024-01-01')` = `new Date('2024-01-06T23:59:59.999Z')`
|
|
471
|
+
- Advanced usage: `dt().endOfWeek('2024-01-01')` = `new Date('2024-01-06T23:59:59.999Z')`
|
|
472
|
+
|
|
473
|
+
### startOfMonth
|
|
474
|
+
Summary: Returns the start of the month.
|
|
475
|
+
Parameters: `date` (Date | string | number).
|
|
476
|
+
- Returns: `Date`.
|
|
477
|
+
- Simple usage: `dt().startOfMonth('2024-01-15')` = `new Date('2024-01-01T00:00:00.000Z')`
|
|
478
|
+
- Advanced usage: `dt().startOfMonth('2024-01-15')` = `new Date('2024-01-01T00:00:00.000Z')`
|
|
479
|
+
|
|
480
|
+
### endOfMonth
|
|
481
|
+
Summary: Returns the end of the month.
|
|
482
|
+
Parameters: `date` (Date | string | number).
|
|
483
|
+
- Returns: `Date`.
|
|
484
|
+
- Simple usage: `dt().endOfMonth('2024-01-15')` = `new Date('2024-01-31T23:59:59.999Z')`
|
|
485
|
+
- Advanced usage: `dt().endOfMonth('2024-01-15')` = `new Date('2024-01-31T23:59:59.999Z')`
|
|
486
|
+
|
|
487
|
+
### startOfQuarter
|
|
488
|
+
Summary: Returns the start of the quarter.
|
|
489
|
+
Parameters: `date` (Date | string | number).
|
|
490
|
+
- Returns: `Date`.
|
|
491
|
+
- Simple usage: `dt().startOfQuarter('2024-02-01')` = `new Date('2024-01-01T00:00:00.000Z')`
|
|
492
|
+
- Advanced usage: `dt().startOfQuarter('2024-02-01')` = `new Date('2024-01-01T00:00:00.000Z')`
|
|
493
|
+
|
|
494
|
+
### endOfQuarter
|
|
495
|
+
Summary: Returns the end of the quarter.
|
|
496
|
+
Parameters: `date` (Date | string | number).
|
|
497
|
+
- Returns: `Date`.
|
|
498
|
+
- Simple usage: `dt().endOfQuarter('2024-02-01')` = `new Date('2024-03-31T23:59:59.999Z')`
|
|
499
|
+
- Advanced usage: `dt().endOfQuarter('2024-02-01')` = `new Date('2024-03-31T23:59:59.999Z')`
|
|
500
|
+
|
|
501
|
+
### startOfYear
|
|
502
|
+
Summary: Returns the start of the year.
|
|
503
|
+
Parameters: `date` (Date | string | number).
|
|
504
|
+
- Returns: `Date`.
|
|
505
|
+
- Simple usage: `dt().startOfYear('2024-06-01')` = `new Date('2024-01-01T00:00:00.000Z')`
|
|
506
|
+
- Advanced usage: `dt().startOfYear('2024-06-01')` = `new Date('2024-01-01T00:00:00.000Z')`
|
|
507
|
+
|
|
508
|
+
### endOfYear
|
|
509
|
+
Summary: Returns the end of the year.
|
|
510
|
+
Parameters: `date` (Date | string | number).
|
|
511
|
+
- Returns: `Date`.
|
|
512
|
+
- Simple usage: `dt().endOfYear('2024-06-01')` = `new Date('2024-12-31T23:59:59.999Z')`
|
|
513
|
+
- Advanced usage: `dt().endOfYear('2024-06-01')` = `new Date('2024-12-31T23:59:59.999Z')`
|
|
514
|
+
|
|
515
|
+
### diffInSeconds
|
|
516
|
+
Summary: Returns difference in seconds using `differenceInSeconds`.
|
|
517
|
+
Parameters: `dateLeft` (Date | string | number), `dateRight` (Date | string | number).
|
|
518
|
+
- Returns: `number`.
|
|
519
|
+
- Simple usage: `dt().diffInSeconds('2024-01-01T00:00:00Z', '2024-01-01T00:01:00Z')` = `60`
|
|
520
|
+
- Advanced usage: `dt().diffInSeconds('2024-01-01T00:00:00Z', '2024-01-01T00:00:01Z')` = `1`
|
|
521
|
+
|
|
522
|
+
### diffInMinutes
|
|
523
|
+
Summary: Returns difference in minutes using `differenceInMinutes`.
|
|
524
|
+
Parameters: `dateLeft` (Date | string | number), `dateRight` (Date | string | number).
|
|
525
|
+
- Returns: `number`.
|
|
526
|
+
- Simple usage: `dt().diffInMinutes('2024-01-01T00:00:00Z', '2024-01-02T00:00:00Z')` = `1440`
|
|
527
|
+
- Advanced usage: `dt().diffInMinutes('2024-01-01T00:00:00Z', '2024-01-01T00:01:00Z')` = `1`
|
|
528
|
+
|
|
529
|
+
### diffInHours
|
|
530
|
+
Summary: Returns difference in hours using `differenceInHours`.
|
|
531
|
+
Parameters: `dateLeft` (Date | string | number), `dateRight` (Date | string | number).
|
|
532
|
+
- Returns: `number`.
|
|
533
|
+
- Simple usage: `dt().diffInHours('2024-01-01T00:00:00Z', '2024-01-02T00:00:00Z')` = `24`
|
|
534
|
+
- Advanced usage: `dt().diffInHours('2024-01-01T00:00:00Z', '2024-01-01T01:00:00Z')` = `1`
|
|
535
|
+
|
|
536
|
+
### diffInDays
|
|
537
|
+
Summary: Returns difference in days using `differenceInDays`.
|
|
538
|
+
Parameters: `dateLeft` (Date | string | number), `dateRight` (Date | string | number).
|
|
539
|
+
- Returns: `number`.
|
|
540
|
+
- Simple usage: `dt().diffInDays('2024-01-01', '2024-02-01')` = `31`
|
|
541
|
+
- Advanced usage: `dt().diffInDays('2024-01-01', '2024-01-02')` = `1`
|
|
542
|
+
|
|
543
|
+
### diffInWeeks
|
|
544
|
+
Summary: Returns difference in weeks using `differenceInWeeks`.
|
|
545
|
+
Parameters: `dateLeft` (Date | string | number), `dateRight` (Date | string | number).
|
|
546
|
+
- Returns: `number`.
|
|
547
|
+
- Simple usage: `dt().diffInWeeks('2024-01-01', '2024-02-01')` = `4`
|
|
548
|
+
- Advanced usage: `dt().diffInWeeks('2024-01-01', '2024-01-08')` = `1`
|
|
549
|
+
|
|
550
|
+
### diffInMonths
|
|
551
|
+
Summary: Returns difference in months using `differenceInMonths`.
|
|
552
|
+
Parameters: `dateLeft` (Date | string | number), `dateRight` (Date | string | number).
|
|
553
|
+
- Returns: `number`.
|
|
554
|
+
- Simple usage: `dt().diffInMonths('2024-01-01', '2024-03-01')` = `2`
|
|
555
|
+
- Advanced usage: `dt().diffInMonths('2024-01-01', '2023-01-01')` = `12`
|
|
556
|
+
|
|
557
|
+
### diffInYears
|
|
558
|
+
Summary: Returns difference in years using `differenceInYears`.
|
|
559
|
+
Parameters: `dateLeft` (Date | string | number), `dateRight` (Date | string | number).
|
|
560
|
+
- Returns: `number`.
|
|
561
|
+
- Simple usage: `dt().diffInYears('2020-01-01', '2024-01-01')` = `4`
|
|
562
|
+
- Advanced usage: `dt().diffInYears('2010-01-01', '2024-01-01')` = `14`
|
|
563
|
+
|
|
564
|
+
### isBefore
|
|
565
|
+
Summary: Checks if a date is before another.
|
|
566
|
+
Parameters: `date` (Date | string | number), `dateToCompare` (Date | string | number).
|
|
567
|
+
- Returns: `boolean`.
|
|
568
|
+
- Simple usage: `dt().isBefore('2024-01-01', '2024-02-01')` = `true`
|
|
569
|
+
- Advanced usage: `dt().isBefore('2024-01-01T00:00:00Z', '2024-01-01T00:00:01Z')` = `true`
|
|
570
|
+
|
|
571
|
+
### isAfter
|
|
572
|
+
Summary: Checks if a date is after another.
|
|
573
|
+
Parameters: `date` (Date | string | number), `dateToCompare` (Date | string | number).
|
|
574
|
+
- Returns: `boolean`.
|
|
575
|
+
- Simple usage: `dt().isAfter('2024-02-01', '2024-01-01')` = `true`
|
|
576
|
+
- Advanced usage: `dt().isAfter('2024-01-01T00:00:01Z', '2024-01-01T00:00:00Z')` = `true`
|
|
577
|
+
|
|
578
|
+
### isEqual
|
|
579
|
+
Summary: Checks if two dates are equal.
|
|
580
|
+
Parameters: `date` (Date | string | number), `dateToCompare` (Date | string | number).
|
|
581
|
+
- Returns: `boolean`.
|
|
582
|
+
- Simple usage: `dt().isEqual('2024-01-01', '2024-01-01')` = `true`
|
|
583
|
+
- Advanced usage: `dt().isEqual('1970-01-01T00:00:00Z', 0)` = `true`
|
|
584
|
+
|
|
585
|
+
### isSameSecond
|
|
586
|
+
Summary: Checks if two dates are in the same second.
|
|
587
|
+
Parameters: `date` (Date | string | number), `dateToCompare` (Date | string | number).
|
|
588
|
+
- Returns: `boolean`.
|
|
589
|
+
- Simple usage: `dt().isSameSecond('2024-01-01T00:00:00Z', '2024-01-01T00:00:00Z')` = `true`
|
|
590
|
+
- Advanced usage: `dt().isSameSecond('2024-01-01T00:00:00Z', '2024-01-01T00:00:00Z')` = `true`
|
|
591
|
+
|
|
592
|
+
### isSameMinute
|
|
593
|
+
Summary: Checks if two dates are in the same minute.
|
|
594
|
+
Parameters: `date` (Date | string | number), `dateToCompare` (Date | string | number).
|
|
595
|
+
- Returns: `boolean`.
|
|
596
|
+
- Simple usage: `dt().isSameMinute('2024-01-01T00:00:00Z', '2024-01-01T00:00:30Z')` = `true`
|
|
597
|
+
- Advanced usage: `dt().isSameMinute('2024-01-01T00:00:00Z', '2024-01-01T00:00:30Z')` = `true`
|
|
598
|
+
|
|
599
|
+
### isSameHour
|
|
600
|
+
Summary: Checks if two dates are in the same hour.
|
|
601
|
+
Parameters: `date` (Date | string | number), `dateToCompare` (Date | string | number).
|
|
602
|
+
- Returns: `boolean`.
|
|
603
|
+
- Simple usage: `dt().isSameHour('2024-01-01T10:00:00Z', '2024-01-01T10:59:59Z')` = `true`
|
|
604
|
+
- Advanced usage: `dt().isSameHour('2024-01-01T10:00:00Z', '2024-01-01T10:59:59Z')` = `true`
|
|
605
|
+
|
|
606
|
+
### isSameDay
|
|
607
|
+
Summary: Checks if two dates are on the same day.
|
|
608
|
+
Parameters: `date` (Date | string | number), `dateToCompare` (Date | string | number).
|
|
609
|
+
- Returns: `boolean`.
|
|
610
|
+
- Simple usage: `dt().isSameDay('2024-01-01T00:00:00Z', '2024-01-01T23:59:59Z')` = `true`
|
|
611
|
+
- Advanced usage: `dt().isSameDay('2024-01-01T00:00:00Z', '2024-01-01T23:59:59Z')` = `true`
|
|
612
|
+
|
|
613
|
+
### isSameWeek
|
|
614
|
+
Summary: Checks if two dates are in the same week.
|
|
615
|
+
Parameters: `date` (Date | string | number), `dateToCompare` (Date | string | number).
|
|
616
|
+
- Returns: `boolean`.
|
|
617
|
+
- Simple usage: `dt().isSameWeek('2024-01-01', '2024-01-07')` = `true`
|
|
618
|
+
- Advanced usage: `dt().isSameWeek('2024-01-01', '2024-01-07')` = `true`
|
|
619
|
+
|
|
620
|
+
### isSameMonth
|
|
621
|
+
Summary: Checks if two dates are in the same month.
|
|
622
|
+
Parameters: `date` (Date | string | number), `dateToCompare` (Date | string | number).
|
|
623
|
+
- Returns: `boolean`.
|
|
624
|
+
- Simple usage: `dt().isSameMonth('2024-01-01', '2024-01-31')` = `true`
|
|
625
|
+
- Advanced usage: `dt().isSameMonth('2024-01-01', '2024-01-31')` = `true`
|
|
626
|
+
|
|
627
|
+
### isSameYear
|
|
628
|
+
Summary: Checks if two dates are in the same year.
|
|
629
|
+
Parameters: `date` (Date | string | number), `dateToCompare` (Date | string | number).
|
|
630
|
+
- Returns: `boolean`.
|
|
631
|
+
- Simple usage: `dt().isSameYear('2024-01-01', '2024-12-31')` = `true`
|
|
632
|
+
- Advanced usage: `dt().isSameYear('2024-01-01', '2024-12-31')` = `true`
|
|
633
|
+
|
|
634
|
+
### isToday
|
|
635
|
+
Summary: Checks if the date is today.
|
|
636
|
+
Parameters: `date` (Date | string | number).
|
|
637
|
+
- Returns: `boolean`.
|
|
638
|
+
- Simple usage: `dt().isToday('2024-01-01')` = `true`
|
|
639
|
+
- Advanced usage: `dt().isToday('2024-01-02')` = `false`
|
|
640
|
+
|
|
641
|
+
### isTomorrow
|
|
642
|
+
Summary: Checks if the date is tomorrow.
|
|
643
|
+
Parameters: `date` (Date | string | number).
|
|
644
|
+
- Returns: `boolean`.
|
|
645
|
+
- Simple usage: `dt().isTomorrow('2024-01-02')` = `true`
|
|
646
|
+
- Advanced usage: `dt().isTomorrow('2024-01-01')` = `false`
|
|
647
|
+
|
|
648
|
+
### isYesterday
|
|
649
|
+
Summary: Checks if the date is yesterday.
|
|
650
|
+
Parameters: `date` (Date | string | number).
|
|
651
|
+
- Returns: `boolean`.
|
|
652
|
+
- Simple usage: `dt().isYesterday('2023-12-31')` = `true`
|
|
653
|
+
- Advanced usage: `dt().isYesterday('2024-01-01')` = `false`
|
|
654
|
+
|
|
655
|
+
### isWeekend
|
|
656
|
+
Summary: Checks if the date is on a weekend.
|
|
657
|
+
Parameters: `date` (Date | string | number).
|
|
658
|
+
- Returns: `boolean`.
|
|
659
|
+
- Simple usage: `dt().isWeekend('2024-01-06')` = `true`
|
|
660
|
+
- Advanced usage: `dt().isWeekend('2024-01-07')` = `true`
|
|
661
|
+
|
|
662
|
+
### isPast
|
|
663
|
+
Summary: Checks if the date is in the past.
|
|
664
|
+
Parameters: `date` (Date | string | number).
|
|
665
|
+
- Returns: `boolean`.
|
|
666
|
+
- Simple usage: `dt().isPast('2020-01-01')` = `true`
|
|
667
|
+
- Advanced usage: `dt().isPast('2024-01-01T00:00:00Z')` = `true`
|
|
668
|
+
|
|
669
|
+
### isFuture
|
|
670
|
+
Summary: Checks if the date is in the future.
|
|
671
|
+
Parameters: `date` (Date | string | number).
|
|
672
|
+
- Returns: `boolean`.
|
|
673
|
+
- Simple usage: `dt().isFuture('2999-01-01')` = `true`
|
|
674
|
+
- Advanced usage: `dt().isFuture('2025-01-01')` = `true`
|
|
675
|
+
|
|
676
|
+
### isThisWeek
|
|
677
|
+
Summary: Checks if the date is in the current week.
|
|
678
|
+
Parameters: `date` (Date | string | number).
|
|
679
|
+
- Returns: `boolean`.
|
|
680
|
+
- Simple usage: `dt().isThisWeek('2024-01-01')` = `true`
|
|
681
|
+
- Advanced usage: `dt().isThisWeek('2023-12-01')` = `false`
|
|
682
|
+
|
|
683
|
+
### isThisMonth
|
|
684
|
+
Summary: Checks if the date is in the current month.
|
|
685
|
+
Parameters: `date` (Date | string | number).
|
|
686
|
+
- Returns: `boolean`.
|
|
687
|
+
- Simple usage: `dt().isThisMonth('2024-01-15')` = `true`
|
|
688
|
+
- Advanced usage: `dt().isThisMonth('2024-01-15')` = `true`
|
|
689
|
+
|
|
690
|
+
### isThisYear
|
|
691
|
+
Summary: Checks if the date is in the current year.
|
|
692
|
+
Parameters: `date` (Date | string | number).
|
|
693
|
+
- Returns: `boolean`.
|
|
694
|
+
- Simple usage: `dt().isThisYear('2024-06-01')` = `true`
|
|
695
|
+
- Advanced usage: `dt().isThisYear('2024-06-01')` = `true`
|
|
696
|
+
|
|
697
|
+
### isValid
|
|
698
|
+
Summary: Checks if a date is valid.
|
|
699
|
+
Parameters: `date` (Date | string | number).
|
|
700
|
+
- Returns: `boolean`.
|
|
701
|
+
- Simple usage: `dt().isValid('2024-01-01')` = `true`
|
|
702
|
+
- Advanced usage: `dt().isValid('invalid-date')` = `false`
|