@kikiutils/shared 18.0.1 → 18.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/dist/buffer.d.ts +19 -21
  2. package/dist/buffer.d.ts.map +1 -1
  3. package/dist/buffer.js +18 -19
  4. package/dist/buffer.js.map +1 -1
  5. package/dist/classes/enhanced-date.d.ts +457 -0
  6. package/dist/classes/enhanced-date.d.ts.map +1 -0
  7. package/dist/classes/enhanced-date.js +635 -0
  8. package/dist/classes/enhanced-date.js.map +1 -0
  9. package/dist/classes/path.d.ts +211 -48
  10. package/dist/classes/path.d.ts.map +1 -1
  11. package/dist/classes/path.js +188 -54
  12. package/dist/classes/path.js.map +1 -1
  13. package/dist/classes/precision-number.d.ts +44 -39
  14. package/dist/classes/precision-number.d.ts.map +1 -1
  15. package/dist/classes/precision-number.js +51 -45
  16. package/dist/classes/precision-number.js.map +1 -1
  17. package/dist/classes/ssh-client.d.ts +3 -4
  18. package/dist/classes/ssh-client.d.ts.map +1 -1
  19. package/dist/classes/ssh-client.js +2 -2
  20. package/dist/classes/ssh-client.js.map +1 -1
  21. package/dist/clipboard.d.ts +25 -26
  22. package/dist/clipboard.d.ts.map +1 -1
  23. package/dist/clipboard.js +23 -23
  24. package/dist/clipboard.js.map +1 -1
  25. package/dist/consola.d.ts +12 -15
  26. package/dist/consola.d.ts.map +1 -1
  27. package/dist/consola.js +10 -12
  28. package/dist/consola.js.map +1 -1
  29. package/dist/crypto-hash.d.ts +65 -56
  30. package/dist/crypto-hash.d.ts.map +1 -1
  31. package/dist/crypto-hash.js +55 -45
  32. package/dist/crypto-hash.js.map +1 -1
  33. package/dist/datetime.d.ts +41 -53
  34. package/dist/datetime.d.ts.map +1 -1
  35. package/dist/datetime.js +53 -66
  36. package/dist/datetime.js.map +1 -1
  37. package/dist/element-plus.d.ts +13 -14
  38. package/dist/element-plus.d.ts.map +1 -1
  39. package/dist/element-plus.js +11 -11
  40. package/dist/element-plus.js.map +1 -1
  41. package/dist/enum.d.ts +39 -36
  42. package/dist/enum.d.ts.map +1 -1
  43. package/dist/enum.js +36 -32
  44. package/dist/enum.js.map +1 -1
  45. package/dist/env.d.ts +22 -15
  46. package/dist/env.d.ts.map +1 -1
  47. package/dist/env.js +20 -12
  48. package/dist/env.js.map +1 -1
  49. package/dist/event-awaiter.d.ts +47 -52
  50. package/dist/event-awaiter.d.ts.map +1 -1
  51. package/dist/event-awaiter.js +46 -50
  52. package/dist/event-awaiter.js.map +1 -1
  53. package/dist/general.d.ts +22 -17
  54. package/dist/general.d.ts.map +1 -1
  55. package/dist/general.js.map +1 -1
  56. package/dist/hash.d.ts +24 -21
  57. package/dist/hash.d.ts.map +1 -1
  58. package/dist/hash.js +20 -16
  59. package/dist/hash.js.map +1 -1
  60. package/dist/math.d.ts +20 -19
  61. package/dist/math.d.ts.map +1 -1
  62. package/dist/math.js +14 -12
  63. package/dist/math.js.map +1 -1
  64. package/dist/number.d.ts +10 -9
  65. package/dist/number.d.ts.map +1 -1
  66. package/dist/number.js +9 -7
  67. package/dist/number.js.map +1 -1
  68. package/dist/object.d.ts +22 -10
  69. package/dist/object.d.ts.map +1 -1
  70. package/dist/object.js +21 -8
  71. package/dist/object.js.map +1 -1
  72. package/dist/pino.d.ts +13 -15
  73. package/dist/pino.d.ts.map +1 -1
  74. package/dist/pino.js +10 -15
  75. package/dist/pino.js.map +1 -1
  76. package/dist/random.d.ts +17 -15
  77. package/dist/random.d.ts.map +1 -1
  78. package/dist/random.js +16 -13
  79. package/dist/random.js.map +1 -1
  80. package/dist/redis/script-runner.d.ts +57 -0
  81. package/dist/redis/script-runner.d.ts.map +1 -0
  82. package/dist/redis/script-runner.js +46 -0
  83. package/dist/redis/script-runner.js.map +1 -0
  84. package/dist/storages/lru/keyed-store.d.ts +18 -14
  85. package/dist/storages/lru/keyed-store.d.ts.map +1 -1
  86. package/dist/storages/lru/keyed-store.js +17 -12
  87. package/dist/storages/lru/keyed-store.js.map +1 -1
  88. package/dist/storages/redis/keyed-store.d.ts +11 -21
  89. package/dist/storages/redis/keyed-store.d.ts.map +1 -1
  90. package/dist/storages/redis/keyed-store.js +10 -19
  91. package/dist/storages/redis/keyed-store.js.map +1 -1
  92. package/dist/storages/redis/msgpack.d.ts +33 -13
  93. package/dist/storages/redis/msgpack.d.ts.map +1 -1
  94. package/dist/storages/redis/msgpack.js +32 -11
  95. package/dist/storages/redis/msgpack.js.map +1 -1
  96. package/dist/storages/redis/types.d.ts +34 -17
  97. package/dist/storages/redis/types.d.ts.map +1 -1
  98. package/dist/string.d.ts +12 -11
  99. package/dist/string.d.ts.map +1 -1
  100. package/dist/string.js +20 -15
  101. package/dist/string.js.map +1 -1
  102. package/dist/time.d.ts +26 -21
  103. package/dist/time.d.ts.map +1 -1
  104. package/dist/time.js +24 -18
  105. package/dist/time.js.map +1 -1
  106. package/dist/types/filtered-key-path.d.ts +4 -15
  107. package/dist/types/filtered-key-path.d.ts.map +1 -1
  108. package/dist/types/index.d.ts +10 -10
  109. package/dist/types/index.d.ts.map +1 -1
  110. package/dist/types/vue.d.ts +7 -7
  111. package/dist/types/vue.d.ts.map +1 -1
  112. package/dist/url.d.ts +15 -14
  113. package/dist/url.d.ts.map +1 -1
  114. package/dist/url.js +12 -10
  115. package/dist/url.js.map +1 -1
  116. package/dist/vue.d.ts +19 -21
  117. package/dist/vue.d.ts.map +1 -1
  118. package/dist/vue.js +15 -16
  119. package/dist/vue.js.map +1 -1
  120. package/dist/web.d.ts +14 -11
  121. package/dist/web.d.ts.map +1 -1
  122. package/dist/web.js +12 -8
  123. package/dist/web.js.map +1 -1
  124. package/package.json +21 -21
  125. package/src/buffer.ts +18 -19
  126. package/src/classes/enhanced-date.ts +715 -0
  127. package/src/classes/path.ts +248 -96
  128. package/src/classes/precision-number.ts +61 -53
  129. package/src/classes/ssh-client.ts +8 -5
  130. package/src/clipboard.ts +23 -23
  131. package/src/consola.ts +10 -12
  132. package/src/crypto-hash.ts +55 -45
  133. package/src/datetime.ts +65 -85
  134. package/src/element-plus.ts +11 -11
  135. package/src/enum.ts +36 -32
  136. package/src/env.ts +20 -12
  137. package/src/event-awaiter.ts +49 -50
  138. package/src/general.ts +20 -14
  139. package/src/hash.ts +20 -16
  140. package/src/math.ts +18 -16
  141. package/src/number.ts +9 -7
  142. package/src/object.ts +21 -8
  143. package/src/pino.ts +11 -15
  144. package/src/random.ts +16 -13
  145. package/src/redis/script-runner.ts +107 -0
  146. package/src/storages/lru/keyed-store.ts +17 -12
  147. package/src/storages/redis/keyed-store.ts +10 -19
  148. package/src/storages/redis/msgpack.ts +32 -11
  149. package/src/storages/redis/types.ts +32 -14
  150. package/src/string.ts +10 -8
  151. package/src/time.ts +24 -18
  152. package/src/types/filtered-key-path.ts +9 -14
  153. package/src/types/vue.ts +6 -5
  154. package/src/url.ts +12 -10
  155. package/src/vue.ts +15 -16
  156. package/src/web.ts +12 -8
package/dist/buffer.d.ts CHANGED
@@ -2,36 +2,34 @@ import { BinaryInput } from "./types/index.js";
2
2
  import { Buffer } from "node:buffer";
3
3
  //#region src/buffer.d.ts
4
4
  /**
5
- * Converts various binary data types to a Node.js Buffer.
5
+ * Converts binary input to a Node.js `Buffer`.
6
6
  *
7
- * This function provides a unified, efficient way to convert different binary formats
8
- * (Blob, Buffer, File, ArrayBuffer, or Uint8Array) into a Node.js Buffer.
9
- * It prioritizes zero-copy conversions for TypedArrays and ArrayBuffers to ensure
10
- * optimal performance.
7
+ * @remarks
8
+ * An existing `Buffer` is returned unchanged. `ArrayBuffer` and `Uint8Array` inputs share their backing memory
9
+ * with the result, so changes are visible through both views. `Blob` and `File` inputs are read asynchronously.
11
10
  *
12
- * @param {ArrayBuffer | Blob | Buffer | File | Uint8Array} input - The binary data input to convert.
13
- * Supports Blob, Buffer, File, ArrayBuffer, and Uint8Array.
11
+ * @param input - The binary data to convert.
14
12
  *
15
- * @returns {Promise<Buffer>} A promise that resolves to a Node.js Buffer.
13
+ * @returns A promise resolving to the original buffer or a new buffer view after the input is available.
14
+ *
15
+ * @throws TypeError through promise rejection if the input is unsupported.
16
16
  *
17
17
  * @example
18
- * ```typescript
19
- * import { toBuffer } from '@kikiutils/shared/buffer';
20
18
  *
21
- * // From ArrayBuffer
22
- * const ab = new ArrayBuffer(8);
23
- * const bufferFromAB = await toBuffer(ab);
19
+ * ```ts
20
+ * import { toBuffer } from '@kikiutils/shared/buffer';
24
21
  *
25
- * // From Uint8Array (Zero-copy)
26
- * const u8 = new Uint8Array([10, 20, 30]);
27
- * const bufferFromU8 = await toBuffer(u8);
22
+ * const bytes = new Uint8Array([
23
+ * 10,
24
+ * 20,
25
+ * 30,
26
+ * ]);
28
27
  *
29
- * // From Blob or File
30
- * const blob = new Blob(['data'], { type: 'text/plain' });
31
- * const bufferFromBlob = await toBuffer(blob);
28
+ * const buffer = await toBuffer(bytes);
29
+ * bytes[0] = 40;
30
+ * console.log(buffer[0]); // => 40
32
31
  * ```
33
32
  */
34
- declare function toBuffer(input: BinaryInput): Promise<Buffer<ArrayBufferLike>>;
33
+ export declare function toBuffer(input: BinaryInput): Promise<Buffer<ArrayBufferLike>>;
35
34
  //#endregion
36
- export { toBuffer };
37
35
  //# sourceMappingURL=buffer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"buffer.d.ts","names":[],"sources":["../src/buffer.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAkCsB,SAAS,OAAO,cAAW,QAAA,OAAA"}
1
+ {"version":3,"file":"buffer.d.ts","names":[],"sources":["../src/buffer.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAiCsB,SAAS,OAAO,cAAW,QAAA,OAAA"}
package/dist/buffer.js CHANGED
@@ -1,33 +1,32 @@
1
1
  import { Buffer } from "node:buffer";
2
2
  //#region src/buffer.ts
3
3
  /**
4
- * Converts various binary data types to a Node.js Buffer.
4
+ * Converts binary input to a Node.js `Buffer`.
5
5
  *
6
- * This function provides a unified, efficient way to convert different binary formats
7
- * (Blob, Buffer, File, ArrayBuffer, or Uint8Array) into a Node.js Buffer.
8
- * It prioritizes zero-copy conversions for TypedArrays and ArrayBuffers to ensure
9
- * optimal performance.
6
+ * @remarks
7
+ * An existing `Buffer` is returned unchanged. `ArrayBuffer` and `Uint8Array` inputs share their backing memory
8
+ * with the result, so changes are visible through both views. `Blob` and `File` inputs are read asynchronously.
10
9
  *
11
- * @param {ArrayBuffer | Blob | Buffer | File | Uint8Array} input - The binary data input to convert.
12
- * Supports Blob, Buffer, File, ArrayBuffer, and Uint8Array.
10
+ * @param input - The binary data to convert.
13
11
  *
14
- * @returns {Promise<Buffer>} A promise that resolves to a Node.js Buffer.
12
+ * @returns A promise resolving to the original buffer or a new buffer view after the input is available.
13
+ *
14
+ * @throws TypeError through promise rejection if the input is unsupported.
15
15
  *
16
16
  * @example
17
- * ```typescript
18
- * import { toBuffer } from '@kikiutils/shared/buffer';
19
17
  *
20
- * // From ArrayBuffer
21
- * const ab = new ArrayBuffer(8);
22
- * const bufferFromAB = await toBuffer(ab);
18
+ * ```ts
19
+ * import { toBuffer } from '@kikiutils/shared/buffer';
23
20
  *
24
- * // From Uint8Array (Zero-copy)
25
- * const u8 = new Uint8Array([10, 20, 30]);
26
- * const bufferFromU8 = await toBuffer(u8);
21
+ * const bytes = new Uint8Array([
22
+ * 10,
23
+ * 20,
24
+ * 30,
25
+ * ]);
27
26
  *
28
- * // From Blob or File
29
- * const blob = new Blob(['data'], { type: 'text/plain' });
30
- * const bufferFromBlob = await toBuffer(blob);
27
+ * const buffer = await toBuffer(bytes);
28
+ * bytes[0] = 40;
29
+ * console.log(buffer[0]); // => 40
31
30
  * ```
32
31
  */
33
32
  async function toBuffer(input) {
@@ -1 +1 @@
1
- {"version":3,"file":"buffer.js","names":[],"sources":["../src/buffer.ts"],"sourcesContent":["import { Buffer } from 'node:buffer';\n\nimport type { BinaryInput } from './types';\n\n/**\n * Converts various binary data types to a Node.js Buffer.\n *\n * This function provides a unified, efficient way to convert different binary formats\n * (Blob, Buffer, File, ArrayBuffer, or Uint8Array) into a Node.js Buffer.\n * It prioritizes zero-copy conversions for TypedArrays and ArrayBuffers to ensure\n * optimal performance.\n *\n * @param {ArrayBuffer | Blob | Buffer | File | Uint8Array} input - The binary data input to convert.\n * Supports Blob, Buffer, File, ArrayBuffer, and Uint8Array.\n *\n * @returns {Promise<Buffer>} A promise that resolves to a Node.js Buffer.\n *\n * @example\n * ```typescript\n * import { toBuffer } from '@kikiutils/shared/buffer';\n *\n * // From ArrayBuffer\n * const ab = new ArrayBuffer(8);\n * const bufferFromAB = await toBuffer(ab);\n *\n * // From Uint8Array (Zero-copy)\n * const u8 = new Uint8Array([10, 20, 30]);\n * const bufferFromU8 = await toBuffer(u8);\n *\n * // From Blob or File\n * const blob = new Blob(['data'], { type: 'text/plain' });\n * const bufferFromBlob = await toBuffer(blob);\n * ```\n */\nexport async function toBuffer(input: BinaryInput) {\n if (Buffer.isBuffer(input)) return input;\n if (input instanceof ArrayBuffer) return Buffer.from(input);\n if (input instanceof Uint8Array) return Buffer.from(input.buffer, input.byteOffset, input.byteLength);\n if (typeof input.arrayBuffer === 'function') return Buffer.from(await input.arrayBuffer());\n // eslint-disable-next-line style/max-len\n throw new TypeError('The provided input is not a supported binary type (Blob, Buffer, File, ArrayBuffer, or Uint8Array).');\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,eAAsB,SAAS,OAAoB;CAC/C,IAAI,OAAO,SAAS,KAAK,GAAG,OAAO;CACnC,IAAI,iBAAiB,aAAa,OAAO,OAAO,KAAK,KAAK;CAC1D,IAAI,iBAAiB,YAAY,OAAO,OAAO,KAAK,MAAM,QAAQ,MAAM,YAAY,MAAM,UAAU;CACpG,IAAI,OAAO,MAAM,gBAAgB,YAAY,OAAO,OAAO,KAAK,MAAM,MAAM,YAAY,CAAC;CAEzF,MAAM,IAAI,UAAU,qGAAqG;AAC7H"}
1
+ {"version":3,"file":"buffer.js","names":[],"sources":["../src/buffer.ts"],"sourcesContent":["import { Buffer } from 'node:buffer';\n\nimport type { BinaryInput } from './types';\n\n/**\n * Converts binary input to a Node.js `Buffer`.\n *\n * @remarks\n * An existing `Buffer` is returned unchanged. `ArrayBuffer` and `Uint8Array` inputs share their backing memory\n * with the result, so changes are visible through both views. `Blob` and `File` inputs are read asynchronously.\n *\n * @param input - The binary data to convert.\n *\n * @returns A promise resolving to the original buffer or a new buffer view after the input is available.\n *\n * @throws TypeError through promise rejection if the input is unsupported.\n *\n * @example\n *\n * ```ts\n * import { toBuffer } from '@kikiutils/shared/buffer';\n *\n * const bytes = new Uint8Array([\n * 10,\n * 20,\n * 30,\n * ]);\n *\n * const buffer = await toBuffer(bytes);\n * bytes[0] = 40;\n * console.log(buffer[0]); // => 40\n * ```\n */\nexport async function toBuffer(input: BinaryInput) {\n if (Buffer.isBuffer(input)) return input;\n if (input instanceof ArrayBuffer) return Buffer.from(input);\n if (input instanceof Uint8Array) return Buffer.from(input.buffer, input.byteOffset, input.byteLength);\n if (typeof input.arrayBuffer === 'function') return Buffer.from(await input.arrayBuffer());\n // eslint-disable-next-line style/max-len\n throw new TypeError('The provided input is not a supported binary type (Blob, Buffer, File, ArrayBuffer, or Uint8Array).');\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,eAAsB,SAAS,OAAoB;CAC/C,IAAI,OAAO,SAAS,KAAK,GAAG,OAAO;CACnC,IAAI,iBAAiB,aAAa,OAAO,OAAO,KAAK,KAAK;CAC1D,IAAI,iBAAiB,YAAY,OAAO,OAAO,KAAK,MAAM,QAAQ,MAAM,YAAY,MAAM,UAAU;CACpG,IAAI,OAAO,MAAM,gBAAgB,YAAY,OAAO,OAAO,KAAK,MAAM,MAAM,YAAY,CAAC;CAEzF,MAAM,IAAI,UAAU,qGAAqG;AAC7H"}
@@ -0,0 +1,457 @@
1
+ import * as dateFns from "date-fns";
2
+ //#region src/classes/enhanced-date.d.ts
3
+ /**
4
+ * A mutable calendar date with chainable date-fns operations.
5
+ *
6
+ * @remarks
7
+ * Inherits the native constructor, including zero-based month arguments and millisecond timestamps.
8
+ * Native methods retain their original behavior.
9
+ * Mutating arithmetic and boundary methods update this instance and return `this`;
10
+ * their `to`-prefixed counterparts return a new `EnhancedDate` instead.
11
+ * Invalid dates, parsing, rounding, and week defaults follow date-fns semantics.
12
+ * Operations use the system time zone unless configured through date-fns options.
13
+ * Day and week arithmetic uses calendar days, preserving local wall-clock time across daylight saving changes.
14
+ * Hour, minute, second, and millisecond arithmetic uses elapsed durations. Month and year arithmetic clamps
15
+ * to the last valid day of the destination month. Native setters retain their native overflow behavior.
16
+ * Exceptions from date-fns propagate unchanged, and operations can preserve or produce `Invalid Date`.
17
+ *
18
+ * When used in Vue state, prefer replacing the value with a `to`-prefixed result:
19
+ * mutating a Date's internal timestamp does not trigger reactive updates.
20
+ *
21
+ * @example
22
+ *
23
+ * ```ts
24
+ * import { EnhancedDate } from '@kikiutils/shared/classes/enhanced-date';
25
+ *
26
+ * const date = new EnhancedDate('2026-01-31T12:00:00Z');
27
+ * const nextMonth = date.toAddMonths(1); // Original date is unchanged.
28
+ * date.addDays(1).startOfDay(); // Mutates the original date.
29
+ * nextMonth.isAfter(date);
30
+ * ```
31
+ */
32
+ export declare class EnhancedDate extends Date {
33
+ /**
34
+ * Returns a new instance at the end of today in the system time zone.
35
+ */
36
+ static endOfToday(): EnhancedDate;
37
+ /**
38
+ * Returns a new instance at the end of tomorrow in the system time zone.
39
+ */
40
+ static endOfTomorrow(): EnhancedDate;
41
+ /**
42
+ * Returns a new instance at the end of yesterday in the system time zone.
43
+ */
44
+ static endOfYesterday(): EnhancedDate;
45
+ /**
46
+ * Parses a date using date-fns and an explicit reference for missing fields.
47
+ *
48
+ * @param value - Date string to parse.
49
+ * @param pattern - date-fns parsing pattern.
50
+ * @param referenceDate - Reference for fields absent from the pattern.
51
+ * @param options - Options passed to `date-fns/parse`.
52
+ *
53
+ * @returns A new `EnhancedDate`, including `Invalid Date` for invalid values.
54
+ */
55
+ static fromFormat(value: string, pattern: string, referenceDate: dateFns.DateArg<Date>, options?: dateFns.ParseOptions): EnhancedDate;
56
+ /**
57
+ * Parses an ISO 8601 string using date-fns, including its partial-date support.
58
+ *
59
+ * @param value - ISO date string.
60
+ * @param options - Options passed to `date-fns/parseISO`.
61
+ *
62
+ * @returns A new `EnhancedDate`, or `Invalid Date` when parsing fails.
63
+ */
64
+ static fromISO(value: string, options?: dateFns.ParseISOOptions): EnhancedDate;
65
+ /**
66
+ * Creates a date from Unix seconds; native constructor numbers remain milliseconds.
67
+ *
68
+ * @param seconds - Seconds since the Unix epoch.
69
+ */
70
+ static fromUnixSeconds(seconds: number): EnhancedDate;
71
+ /**
72
+ * Returns the latest date as a new independent instance.
73
+ *
74
+ * @param dates - Dates or millisecond timestamps to compare.
75
+ *
76
+ * @returns A new `EnhancedDate`, or `Invalid Date` if the array is empty or contains an invalid date.
77
+ */
78
+ static max(dates: (Date | number)[]): EnhancedDate;
79
+ /**
80
+ * Returns the earliest date as a new independent instance.
81
+ *
82
+ * @param dates - Dates or millisecond timestamps to compare.
83
+ *
84
+ * @returns A new `EnhancedDate`, or `Invalid Date` if the array is empty or contains an invalid date.
85
+ */
86
+ static min(dates: (Date | number)[]): EnhancedDate;
87
+ /**
88
+ * Returns a new instance at the start of today in the system time zone.
89
+ */
90
+ static startOfToday(): EnhancedDate;
91
+ /**
92
+ * Returns a new instance at the start of tomorrow in the system time zone.
93
+ */
94
+ static startOfTomorrow(): EnhancedDate;
95
+ /**
96
+ * Returns a new instance at the start of yesterday in the system time zone.
97
+ */
98
+ static startOfYesterday(): EnhancedDate;
99
+ /**
100
+ * Adds the specified number of days in place using date-fns.
101
+ *
102
+ * @param amount - Number of days.
103
+ *
104
+ * @returns This instance for chaining.
105
+ */
106
+ addDays(amount: number): this;
107
+ /**
108
+ * Adds the specified number of hours in place using date-fns.
109
+ *
110
+ * @param amount - Number of hours.
111
+ *
112
+ * @returns This instance for chaining.
113
+ */
114
+ addHours(amount: number): this;
115
+ /**
116
+ * Adds the specified number of milliseconds in place using date-fns.
117
+ *
118
+ * @param amount - Number of milliseconds.
119
+ *
120
+ * @returns This instance for chaining.
121
+ */
122
+ addMilliseconds(amount: number): this;
123
+ /**
124
+ * Adds the specified number of minutes in place using date-fns.
125
+ *
126
+ * @param amount - Number of minutes.
127
+ *
128
+ * @returns This instance for chaining.
129
+ */
130
+ addMinutes(amount: number): this;
131
+ /**
132
+ * Adds the specified number of months in place using date-fns.
133
+ *
134
+ * @param amount - Number of months.
135
+ *
136
+ * @returns This instance for chaining.
137
+ */
138
+ addMonths(amount: number): this;
139
+ /**
140
+ * Adds the specified number of seconds in place using date-fns.
141
+ *
142
+ * @param amount - Number of seconds.
143
+ *
144
+ * @returns This instance for chaining.
145
+ */
146
+ addSeconds(amount: number): this;
147
+ /**
148
+ * Adds the specified number of weeks in place using date-fns.
149
+ *
150
+ * @param amount - Number of weeks.
151
+ *
152
+ * @returns This instance for chaining.
153
+ */
154
+ addWeeks(amount: number): this;
155
+ /**
156
+ * Adds the specified number of years in place using date-fns.
157
+ *
158
+ * @param amount - Number of years.
159
+ *
160
+ * @returns This instance for chaining.
161
+ */
162
+ addYears(amount: number): this;
163
+ /**
164
+ * Returns a new `EnhancedDate` with the same timestamp, including `Invalid Date`.
165
+ */
166
+ clone(): EnhancedDate;
167
+ /**
168
+ * Returns the signed difference in calendar days: this date minus the other date.
169
+ *
170
+ * @remarks
171
+ * Defaults and rounding follow date-fns.
172
+ */
173
+ differenceInCalendarDays(other: dateFns.DateArg<Date>): number;
174
+ /**
175
+ * Returns the signed difference in calendar weeks: this date minus the other date.
176
+ *
177
+ * @remarks
178
+ * Defaults and rounding follow date-fns.
179
+ */
180
+ differenceInCalendarWeeks(other: dateFns.DateArg<Date>, options?: dateFns.DifferenceInCalendarWeeksOptions): number;
181
+ /**
182
+ * Returns the signed difference in full minutes: this date minus the other date.
183
+ *
184
+ * @remarks
185
+ * Defaults and rounding follow date-fns.
186
+ */
187
+ differenceInMinutes(other: dateFns.DateArg<Date>, options?: dateFns.DifferenceInMinutesOptions): number;
188
+ /**
189
+ * Moves this date to the end of its day in place.
190
+ *
191
+ * @returns This instance for chaining.
192
+ */
193
+ endOfDay(): this;
194
+ /**
195
+ * Moves this date to the end of its minute in place.
196
+ *
197
+ * @returns This instance for chaining.
198
+ */
199
+ endOfMinute(): this;
200
+ /**
201
+ * Moves this date to the end of its month in place.
202
+ *
203
+ * @returns This instance for chaining.
204
+ */
205
+ endOfMonth(): this;
206
+ /**
207
+ * Moves this date to the end of its week in place.
208
+ *
209
+ * @param options - date-fns week options; defaults are unchanged.
210
+ *
211
+ * @returns This instance for chaining.
212
+ */
213
+ endOfWeek(options?: dateFns.EndOfWeekOptions): this;
214
+ /**
215
+ * Formats this date using a date-fns pattern (default: `yyyy-MM-dd HH:mm:ss`) and optional locale/options.
216
+ *
217
+ * @remarks
218
+ * Invalid dates and invalid patterns retain date-fns error behavior.
219
+ */
220
+ format(pattern?: string, options?: dateFns.FormatOptions): string;
221
+ /**
222
+ * Formats the distance from this date to now using date-fns.
223
+ */
224
+ formatDistanceToNow(options?: dateFns.FormatDistanceToNowOptions): string;
225
+ /**
226
+ * Returns Unix seconds using date-fns; `getTime()` returns milliseconds.
227
+ */
228
+ getUnixTime(): number;
229
+ /**
230
+ * Checks whether this date occurs after the other date.
231
+ */
232
+ isAfter(other: dateFns.DateArg<Date>): boolean;
233
+ /**
234
+ * Checks whether this date occurs before the other date.
235
+ */
236
+ isBefore(other: dateFns.DateArg<Date>): boolean;
237
+ /**
238
+ * Checks whether this date has the same timestamp as the other date.
239
+ */
240
+ isEqual(other: dateFns.DateArg<Date>): boolean;
241
+ /**
242
+ * Checks whether this date is after the current time.
243
+ */
244
+ isFuture(): boolean;
245
+ /**
246
+ * Checks whether this date falls on the same calendar day as the other date.
247
+ */
248
+ isSameDay(other: dateFns.DateArg<Date>): boolean;
249
+ /**
250
+ * Checks whether this date falls in the same calendar minute as the other date.
251
+ */
252
+ isSameMinute(other: dateFns.DateArg<Date>): boolean;
253
+ /**
254
+ * Checks whether this date falls on today.
255
+ */
256
+ isToday(): boolean;
257
+ /**
258
+ * Checks whether this date falls on tomorrow.
259
+ */
260
+ isTomorrow(): boolean;
261
+ /**
262
+ * Checks whether this date has a valid timestamp.
263
+ */
264
+ isValid(): boolean;
265
+ /**
266
+ * Moves this date to the start of its day in place.
267
+ *
268
+ * @returns This instance for chaining.
269
+ */
270
+ startOfDay(): this;
271
+ /**
272
+ * Moves this date to the start of its minute in place.
273
+ *
274
+ * @returns This instance for chaining.
275
+ */
276
+ startOfMinute(): this;
277
+ /**
278
+ * Moves this date to the start of its month in place.
279
+ *
280
+ * @returns This instance for chaining.
281
+ */
282
+ startOfMonth(): this;
283
+ /**
284
+ * Moves this date to the start of its week in place.
285
+ *
286
+ * @param options - date-fns week options; defaults are unchanged.
287
+ *
288
+ * @returns This instance for chaining.
289
+ */
290
+ startOfWeek(options?: dateFns.StartOfWeekOptions): this;
291
+ /**
292
+ * Subtracts the specified number of days in place using date-fns.
293
+ *
294
+ * @param amount - Number of days.
295
+ *
296
+ * @returns This instance for chaining.
297
+ */
298
+ subDays(amount: number): this;
299
+ /**
300
+ * Subtracts the specified number of hours in place using date-fns.
301
+ *
302
+ * @param amount - Number of hours.
303
+ *
304
+ * @returns This instance for chaining.
305
+ */
306
+ subHours(amount: number): this;
307
+ /**
308
+ * Subtracts the specified number of milliseconds in place using date-fns.
309
+ *
310
+ * @param amount - Number of milliseconds.
311
+ *
312
+ * @returns This instance for chaining.
313
+ */
314
+ subMilliseconds(amount: number): this;
315
+ /**
316
+ * Subtracts the specified number of minutes in place using date-fns.
317
+ *
318
+ * @param amount - Number of minutes.
319
+ *
320
+ * @returns This instance for chaining.
321
+ */
322
+ subMinutes(amount: number): this;
323
+ /**
324
+ * Subtracts the specified number of months in place using date-fns.
325
+ *
326
+ * @param amount - Number of months.
327
+ *
328
+ * @returns This instance for chaining.
329
+ */
330
+ subMonths(amount: number): this;
331
+ /**
332
+ * Subtracts the specified number of seconds in place using date-fns.
333
+ *
334
+ * @param amount - Number of seconds.
335
+ *
336
+ * @returns This instance for chaining.
337
+ */
338
+ subSeconds(amount: number): this;
339
+ /**
340
+ * Subtracts the specified number of weeks in place using date-fns.
341
+ *
342
+ * @param amount - Number of weeks.
343
+ *
344
+ * @returns This instance for chaining.
345
+ */
346
+ subWeeks(amount: number): this;
347
+ /**
348
+ * Subtracts the specified number of years in place using date-fns.
349
+ *
350
+ * @param amount - Number of years.
351
+ *
352
+ * @returns This instance for chaining.
353
+ */
354
+ subYears(amount: number): this;
355
+ /**
356
+ * Returns a new instance with days added, leaving this date unchanged.
357
+ */
358
+ toAddDays(amount: number): EnhancedDate;
359
+ /**
360
+ * Returns a new instance with hours added, leaving this date unchanged.
361
+ */
362
+ toAddHours(amount: number): EnhancedDate;
363
+ /**
364
+ * Returns a new instance with milliseconds added, leaving this date unchanged.
365
+ */
366
+ toAddMilliseconds(amount: number): EnhancedDate;
367
+ /**
368
+ * Returns a new instance with minutes added, leaving this date unchanged.
369
+ */
370
+ toAddMinutes(amount: number): EnhancedDate;
371
+ /**
372
+ * Returns a new instance with months added, leaving this date unchanged.
373
+ */
374
+ toAddMonths(amount: number): EnhancedDate;
375
+ /**
376
+ * Returns a new instance with seconds added, leaving this date unchanged.
377
+ */
378
+ toAddSeconds(amount: number): EnhancedDate;
379
+ /**
380
+ * Returns a new instance with weeks added, leaving this date unchanged.
381
+ */
382
+ toAddWeeks(amount: number): EnhancedDate;
383
+ /**
384
+ * Returns a new instance with years added, leaving this date unchanged.
385
+ */
386
+ toAddYears(amount: number): EnhancedDate;
387
+ /**
388
+ * Returns a new plain native Date; mutations are not shared with this instance.
389
+ */
390
+ toDate(): Date;
391
+ /**
392
+ * Returns a new instance at the end of this day, leaving this date unchanged.
393
+ */
394
+ toEndOfDay(): EnhancedDate;
395
+ /**
396
+ * Returns a new instance at the end of this minute, leaving this date unchanged.
397
+ */
398
+ toEndOfMinute(): EnhancedDate;
399
+ /**
400
+ * Returns a new instance at the end of this month, leaving this date unchanged.
401
+ */
402
+ toEndOfMonth(): EnhancedDate;
403
+ /**
404
+ * Returns a new instance at the end of this week, leaving this date unchanged.
405
+ */
406
+ toEndOfWeek(options?: dateFns.EndOfWeekOptions): EnhancedDate;
407
+ /**
408
+ * Returns a new instance at the start of this day, leaving this date unchanged.
409
+ */
410
+ toStartOfDay(): EnhancedDate;
411
+ /**
412
+ * Returns a new instance at the start of this minute, leaving this date unchanged.
413
+ */
414
+ toStartOfMinute(): EnhancedDate;
415
+ /**
416
+ * Returns a new instance at the start of this month, leaving this date unchanged.
417
+ */
418
+ toStartOfMonth(): EnhancedDate;
419
+ /**
420
+ * Returns a new instance at the start of this week, leaving this date unchanged.
421
+ */
422
+ toStartOfWeek(options?: dateFns.StartOfWeekOptions): EnhancedDate;
423
+ /**
424
+ * Returns a new instance with days subtracted, leaving this date unchanged.
425
+ */
426
+ toSubDays(amount: number): EnhancedDate;
427
+ /**
428
+ * Returns a new instance with hours subtracted, leaving this date unchanged.
429
+ */
430
+ toSubHours(amount: number): EnhancedDate;
431
+ /**
432
+ * Returns a new instance with milliseconds subtracted, leaving this date unchanged.
433
+ */
434
+ toSubMilliseconds(amount: number): EnhancedDate;
435
+ /**
436
+ * Returns a new instance with minutes subtracted, leaving this date unchanged.
437
+ */
438
+ toSubMinutes(amount: number): EnhancedDate;
439
+ /**
440
+ * Returns a new instance with months subtracted, leaving this date unchanged.
441
+ */
442
+ toSubMonths(amount: number): EnhancedDate;
443
+ /**
444
+ * Returns a new instance with seconds subtracted, leaving this date unchanged.
445
+ */
446
+ toSubSeconds(amount: number): EnhancedDate;
447
+ /**
448
+ * Returns a new instance with weeks subtracted, leaving this date unchanged.
449
+ */
450
+ toSubWeeks(amount: number): EnhancedDate;
451
+ /**
452
+ * Returns a new instance with years subtracted, leaving this date unchanged.
453
+ */
454
+ toSubYears(amount: number): EnhancedDate;
455
+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