@bereasoftware/time-guard 2.6.0 → 2.7.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 (98) hide show
  1. package/README.en.md +232 -0
  2. package/README.md +259 -4
  3. package/dist/{types/adapters → adapters}/temporal.adapter.d.ts +4 -9
  4. package/dist/angular/index.cjs +148 -0
  5. package/dist/angular/index.d.ts +2 -0
  6. package/dist/angular/index.es.js +143 -0
  7. package/dist/angular.d.ts +59 -0
  8. package/dist/calendars/index.cjs +357 -2
  9. package/dist/calendars/index.es.js +99 -68
  10. package/dist/chunk-Ddh6569R.cjs +36 -0
  11. package/dist/core-BAd7GYfw.js +1809 -0
  12. package/dist/core-CafqOI7W.cjs +1892 -0
  13. package/dist/core.d.ts +224 -0
  14. package/dist/index.d.ts +9 -0
  15. package/dist/locales/african.locale.d.ts +7 -0
  16. package/dist/locales/index.cjs +7 -2
  17. package/dist/{types/locales → locales}/index.d.ts +2 -2
  18. package/dist/locales/index.es.js +3 -2797
  19. package/dist/locales/south-american.locale.d.ts +7 -0
  20. package/dist/locales-C2-lOmC8.cjs +3537 -0
  21. package/dist/locales-CcuSu4P1.js +3514 -0
  22. package/dist/native/index.cjs +48 -0
  23. package/dist/native/index.d.ts +2 -0
  24. package/dist/native/index.es.js +18 -0
  25. package/dist/native.d.ts +9 -0
  26. package/dist/plugins/advanced-format.cjs +105 -2
  27. package/dist/plugins/advanced-format.es.js +63 -45
  28. package/dist/plugins/duration.cjs +258 -2
  29. package/dist/plugins/duration.es.js +165 -61
  30. package/dist/plugins/index.d.ts +10 -0
  31. package/dist/plugins/relative-time.cjs +166 -2
  32. package/dist/plugins/relative-time.es.js +74 -37
  33. package/dist/qwik/index.cjs +104 -0
  34. package/dist/qwik/index.d.ts +2 -0
  35. package/dist/qwik/index.es.js +100 -0
  36. package/dist/qwik.d.ts +32 -0
  37. package/dist/react/index.cjs +112 -0
  38. package/dist/react/index.d.ts +2 -0
  39. package/dist/react/index.es.js +103 -0
  40. package/dist/react.d.ts +46 -0
  41. package/dist/solid/index.cjs +127 -0
  42. package/dist/solid/index.d.ts +2 -0
  43. package/dist/solid/index.es.js +122 -0
  44. package/dist/solid.d.ts +53 -0
  45. package/dist/svelte/index.cjs +398 -0
  46. package/dist/svelte/index.d.ts +2 -0
  47. package/dist/svelte/index.es.js +393 -0
  48. package/dist/svelte.d.ts +88 -0
  49. package/dist/time-guard.cjs +7359 -4
  50. package/dist/time-guard.d.ts +2 -0
  51. package/dist/time-guard.es.js +3625 -8073
  52. package/dist/time-guard.iife.js +13549 -4
  53. package/dist/time-guard.umd.js +13550 -4
  54. package/dist/types/index.d.ts +651 -128
  55. package/dist/vue/index.cjs +143 -0
  56. package/dist/vue/index.d.ts +2 -0
  57. package/dist/vue/index.es.js +137 -0
  58. package/dist/vue.d.ts +35 -0
  59. package/package.json +111 -17
  60. package/dist/calendars/index.cjs.map +0 -1
  61. package/dist/calendars/index.es.js.map +0 -1
  62. package/dist/locales/index.cjs.map +0 -1
  63. package/dist/locales/index.es.js.map +0 -1
  64. package/dist/plugins/advanced-format.cjs.map +0 -1
  65. package/dist/plugins/advanced-format.es.js.map +0 -1
  66. package/dist/plugins/duration.cjs.map +0 -1
  67. package/dist/plugins/duration.es.js.map +0 -1
  68. package/dist/plugins/relative-time.cjs.map +0 -1
  69. package/dist/plugins/relative-time.es.js.map +0 -1
  70. package/dist/time-guard.cjs.map +0 -1
  71. package/dist/time-guard.es.js.map +0 -1
  72. package/dist/time-guard.iife.js.map +0 -1
  73. package/dist/time-guard.umd.js.map +0 -1
  74. package/dist/types/plugins/index.d.ts +0 -10
  75. package/dist/types/types/index.d.ts +0 -586
  76. /package/dist/{types/calendars → calendars}/calendar.manager.d.ts +0 -0
  77. /package/dist/{types/calendars → calendars}/index.d.ts +0 -0
  78. /package/dist/{types/formatters → formatters}/date.formatter.d.ts +0 -0
  79. /package/dist/{types/locales → locales}/additional.locale.d.ts +0 -0
  80. /package/dist/{types/locales → locales}/asian.locale.d.ts +0 -0
  81. /package/dist/{types/locales → locales}/english.locale.d.ts +0 -0
  82. /package/dist/{types/locales → locales}/european.locale.d.ts +0 -0
  83. /package/dist/{types/locales → locales}/locale.manager.d.ts +0 -0
  84. /package/dist/{types/locales → locales}/middle-eastern.locale.d.ts +0 -0
  85. /package/dist/{types/locales → locales}/nordic.locale.d.ts +0 -0
  86. /package/dist/{types/locales → locales}/romance.locale.d.ts +0 -0
  87. /package/dist/{types/locales → locales}/slavic.locale.d.ts +0 -0
  88. /package/dist/{types/locales → locales}/spanish.locale.d.ts +0 -0
  89. /package/dist/{types/plugins → plugins}/advanced-format/index.d.ts +0 -0
  90. /package/dist/{types/plugins → plugins}/advanced-format.d.ts +0 -0
  91. /package/dist/{types/plugins → plugins}/duration/index.d.ts +0 -0
  92. /package/dist/{types/plugins → plugins}/duration/types.d.ts +0 -0
  93. /package/dist/{types/plugins → plugins}/duration.d.ts +0 -0
  94. /package/dist/{types/plugins → plugins}/manager.d.ts +0 -0
  95. /package/dist/{types/plugins → plugins}/relative-time/index.d.ts +0 -0
  96. /package/dist/{types/plugins → plugins}/relative-time/types.d.ts +0 -0
  97. /package/dist/{types/plugins → plugins}/relative-time.d.ts +0 -0
  98. /package/dist/{types/utils → utils}/duration-locale.d.ts +0 -0
@@ -0,0 +1,393 @@
1
+ /*! time-guard v2.7.0 | (c) 2026 Berea-Soft | MIT License | https://github.com/Berea-Soft/time-guard */
2
+ import { n as TimeGuard, r as TimeRange } from "../core-BAd7GYfw.js";
3
+ Array.isArray;
4
+ Array.prototype.indexOf;
5
+ Array.prototype.includes;
6
+ Array.from;
7
+ Array.prototype;
8
+ var noop = () => {};
9
+ /** @param {Array<() => void>} arr */
10
+ function run_all(arr) {
11
+ for (var i = 0; i < arr.length; i++) arr[i]();
12
+ }
13
+ //#endregion
14
+ //#region node_modules/.pnpm/svelte@5.55.9_@typescript-eslint+types@8.59.4/node_modules/svelte/src/internal/client/constants.js
15
+ var CLEAN = 1024;
16
+ var DIRTY = 2048;
17
+ var MAYBE_DIRTY = 4096;
18
+ /**
19
+ * 'Transparent' effects do not create a transition boundary.
20
+ * This is on a block effect 99% of the time but may also be on a branch effect if its parent block effect was pruned
21
+ */
22
+ var EFFECT_TRANSPARENT = 65536;
23
+ var EFFECT_PRESERVED = 1 << 19;
24
+ new class StaleReactionError extends Error {
25
+ name = "StaleReactionError";
26
+ message = "The reaction that called `getAbortSignal()` was re-run or destroyed";
27
+ }();
28
+ globalThis.document?.contentType;
29
+ //#endregion
30
+ //#region node_modules/.pnpm/svelte@5.55.9_@typescript-eslint+types@8.59.4/node_modules/svelte/src/internal/client/reactivity/equality.js
31
+ /**
32
+ * @param {unknown} a
33
+ * @param {unknown} b
34
+ * @returns {boolean}
35
+ */
36
+ function safe_not_equal(a, b) {
37
+ return a != a ? b == b : a !== b || a !== null && typeof a === "object" || typeof a === "function";
38
+ }
39
+ ~(DIRTY | MAYBE_DIRTY | CLEAN);
40
+ //#endregion
41
+ //#region node_modules/.pnpm/svelte@5.55.9_@typescript-eslint+types@8.59.4/node_modules/svelte/src/store/utils.js
42
+ /** @import { Readable } from './public' */
43
+ /**
44
+ * @template T
45
+ * @param {Readable<T> | null | undefined} store
46
+ * @param {(value: T) => void} run
47
+ * @param {(value: T) => void} [invalidate]
48
+ * @returns {() => void}
49
+ */
50
+ function subscribe_to_store(store, run, invalidate) {
51
+ if (store == null) {
52
+ run(void 0);
53
+ if (invalidate) invalidate(void 0);
54
+ return noop;
55
+ }
56
+ const unsub = untrack(() => store.subscribe(run, invalidate));
57
+ return unsub.unsubscribe ? () => unsub.unsubscribe() : unsub;
58
+ }
59
+ //#endregion
60
+ //#region node_modules/.pnpm/svelte@5.55.9_@typescript-eslint+types@8.59.4/node_modules/svelte/src/store/shared/index.js
61
+ /** @import { Readable, StartStopNotifier, Subscriber, Unsubscriber, Updater, Writable } from '../public.js' */
62
+ /** @import { Stores, StoresValues, SubscribeInvalidateTuple } from '../private.js' */
63
+ /**
64
+ * @type {Array<SubscribeInvalidateTuple<any> | any>}
65
+ */
66
+ var subscriber_queue = [];
67
+ /**
68
+ * Creates a `Readable` store that allows reading by subscription.
69
+ *
70
+ * @template T
71
+ * @param {T} [value] initial value
72
+ * @param {StartStopNotifier<T>} [start]
73
+ * @returns {Readable<T>}
74
+ */
75
+ function readable(value, start) {
76
+ return { subscribe: writable(value, start).subscribe };
77
+ }
78
+ /**
79
+ * Create a `Writable` store that allows both updating and reading by subscription.
80
+ *
81
+ * @template T
82
+ * @param {T} [value] initial value
83
+ * @param {StartStopNotifier<T>} [start]
84
+ * @returns {Writable<T>}
85
+ */
86
+ function writable(value, start = noop) {
87
+ /** @type {Unsubscriber | null} */
88
+ let stop = null;
89
+ /** @type {Set<SubscribeInvalidateTuple<T>>} */
90
+ const subscribers = /* @__PURE__ */ new Set();
91
+ /**
92
+ * @param {T} new_value
93
+ * @returns {void}
94
+ */
95
+ function set(new_value) {
96
+ if (safe_not_equal(value, new_value)) {
97
+ value = new_value;
98
+ if (stop) {
99
+ const run_queue = !subscriber_queue.length;
100
+ for (const subscriber of subscribers) {
101
+ subscriber[1]();
102
+ subscriber_queue.push(subscriber, value);
103
+ }
104
+ if (run_queue) {
105
+ for (let i = 0; i < subscriber_queue.length; i += 2) subscriber_queue[i][0](subscriber_queue[i + 1]);
106
+ subscriber_queue.length = 0;
107
+ }
108
+ }
109
+ }
110
+ }
111
+ /**
112
+ * @param {Updater<T>} fn
113
+ * @returns {void}
114
+ */
115
+ function update(fn) {
116
+ set(fn(value));
117
+ }
118
+ /**
119
+ * @param {Subscriber<T>} run
120
+ * @param {() => void} [invalidate]
121
+ * @returns {Unsubscriber}
122
+ */
123
+ function subscribe(run, invalidate = noop) {
124
+ /** @type {SubscribeInvalidateTuple<T>} */
125
+ const subscriber = [run, invalidate];
126
+ subscribers.add(subscriber);
127
+ if (subscribers.size === 1) stop = start(set, update) || noop;
128
+ run(value);
129
+ return () => {
130
+ subscribers.delete(subscriber);
131
+ if (subscribers.size === 0 && stop) {
132
+ stop();
133
+ stop = null;
134
+ }
135
+ };
136
+ }
137
+ return {
138
+ set,
139
+ update,
140
+ subscribe
141
+ };
142
+ }
143
+ /**
144
+ * Derived value store by synchronizing one or more readable stores and
145
+ * applying an aggregation function over its input values.
146
+ *
147
+ * @template {Stores} S
148
+ * @template T
149
+ * @overload
150
+ * @param {S} stores
151
+ * @param {(values: StoresValues<S>, set: (value: T) => void, update: (fn: Updater<T>) => void) => Unsubscriber | void} fn
152
+ * @param {T} [initial_value]
153
+ * @returns {Readable<T>}
154
+ */
155
+ /**
156
+ * Derived value store by synchronizing one or more readable stores and
157
+ * applying an aggregation function over its input values.
158
+ *
159
+ * @template {Stores} S
160
+ * @template T
161
+ * @overload
162
+ * @param {S} stores
163
+ * @param {(values: StoresValues<S>) => T} fn
164
+ * @param {T} [initial_value]
165
+ * @returns {Readable<T>}
166
+ */
167
+ /**
168
+ * @template {Stores} S
169
+ * @template T
170
+ * @param {S} stores
171
+ * @param {Function} fn
172
+ * @param {T} [initial_value]
173
+ * @returns {Readable<T>}
174
+ */
175
+ function derived(stores, fn, initial_value) {
176
+ const single = !Array.isArray(stores);
177
+ /** @type {Array<Readable<any>>} */
178
+ const stores_array = single ? [stores] : stores;
179
+ if (!stores_array.every(Boolean)) throw new Error("derived() expects stores as input, got a falsy value");
180
+ const auto = fn.length < 2;
181
+ return readable(initial_value, (set, update) => {
182
+ let started = false;
183
+ /** @type {T[]} */
184
+ const values = [];
185
+ let pending = 0;
186
+ let cleanup = noop;
187
+ const sync = () => {
188
+ if (pending) return;
189
+ cleanup();
190
+ const result = fn(single ? values[0] : values, set, update);
191
+ if (auto) set(result);
192
+ else cleanup = typeof result === "function" ? result : noop;
193
+ };
194
+ const unsubscribers = stores_array.map((store, i) => subscribe_to_store(store, (value) => {
195
+ values[i] = value;
196
+ pending &= ~(1 << i);
197
+ if (started) sync();
198
+ }, () => {
199
+ pending |= 1 << i;
200
+ }));
201
+ started = true;
202
+ sync();
203
+ return function stop() {
204
+ run_all(unsubscribers);
205
+ cleanup();
206
+ started = false;
207
+ };
208
+ });
209
+ }
210
+ EFFECT_TRANSPARENT | EFFECT_PRESERVED;
211
+ //#endregion
212
+ //#region node_modules/.pnpm/svelte@5.55.9_@typescript-eslint+types@8.59.4/node_modules/svelte/src/internal/client/runtime.js
213
+ var untracking = false;
214
+ /**
215
+ * When used inside a [`$derived`](https://svelte.dev/docs/svelte/$derived) or [`$effect`](https://svelte.dev/docs/svelte/$effect),
216
+ * any state read inside `fn` will not be treated as a dependency.
217
+ *
218
+ * ```ts
219
+ * $effect(() => {
220
+ * // this will run when `data` changes, but not when `time` changes
221
+ * save(data, {
222
+ * timestamp: untrack(() => time)
223
+ * });
224
+ * });
225
+ * ```
226
+ * @template T
227
+ * @param {() => T} fn
228
+ * @returns {T}
229
+ */
230
+ function untrack(fn) {
231
+ var previous_untracking = untracking;
232
+ try {
233
+ untracking = true;
234
+ return fn();
235
+ } finally {
236
+ untracking = previous_untracking;
237
+ }
238
+ }
239
+ //#endregion
240
+ //#region src/svelte.ts
241
+ /**
242
+ * TimeGuard — Svelte 5 Integration
243
+ *
244
+ * Provides reactive stores and lifecycle-managed wrappers for TimeGuard.
245
+ * Compatible with both Svelte 4 (`$store` auto-subscription) and
246
+ * Svelte 5 (`$state` + `get()` from stores).
247
+ *
248
+ * @example
249
+ * ```svelte
250
+ * <script lang="ts">
251
+ * import { useCurrentTime, useRelativeTime } from '@bereasoftware/time-guard/svelte';
252
+ *
253
+ * const now = useCurrentTime({ interval: 1000 });
254
+ * const relative = useRelativeTime('2026-05-20T08:00:00');
255
+ * <\/script>
256
+ *
257
+ * <h1>{$now.format('HH:mm:ss')}</h1>
258
+ * <p>Published: {$relative}</p>
259
+ * ```
260
+ */
261
+ /**
262
+ * Duck-type check: is this a Svelte store (has `subscribe`)?
263
+ */
264
+ function isStore(val) {
265
+ return typeof val === "object" && val !== null && "subscribe" in val && typeof val.subscribe === "function";
266
+ }
267
+ /**
268
+ * Coerce a plain value or a store into a Readable store.
269
+ */
270
+ function toStore(val) {
271
+ return isStore(val) ? val : readable(val);
272
+ }
273
+ /**
274
+ * Injection-key symbol to retrieve a global TimeGuard configuration
275
+ * provided at the app root. Consumers use `getContext(TimeGuardConfigKey)`.
276
+ */
277
+ var TimeGuardConfigKey = Symbol("TimeGuardConfig");
278
+ /**
279
+ * Creates a reactive readable store of a TimeGuard instance.
280
+ * Automatically updates when `input` changes (supports both plain values
281
+ * and Svelte stores as input — pass a `Readable` for full reactivity).
282
+ * Integrates global config from `getContext(TimeGuardConfigKey)` as fallback.
283
+ *
284
+ * ```svelte
285
+ * <script>
286
+ * import { writable } from 'svelte/store';
287
+ * import { useTimeGuard } from '@bereasoftware/time-guard/svelte';
288
+ * import { TimeGuard } from '@bereasoftware/time-guard';
289
+ *
290
+ * // Static input — no reactivity needed
291
+ * const tg = useTimeGuard('2026-05-20');
292
+ *
293
+ * // Reactive input — pass a store
294
+ * const dateStore = writable('2026-05-20');
295
+ * const tg2 = useTimeGuard(dateStore);
296
+ * <\/script>
297
+ *
298
+ * <p>{$tg.format('dddd, DD MMMM YYYY')}</p>
299
+ * <p>{$tg2.format('dddd, DD MMMM YYYY')}</p>
300
+ * ```
301
+ */
302
+ function useTimeGuard(input, config) {
303
+ if (isStore(input)) return derived(input, ($val) => TimeGuard.from($val, config));
304
+ return readable(TimeGuard.from(input, config));
305
+ }
306
+ /**
307
+ * Creates a readable store of the current time that ticks on a specified
308
+ * interval (default 1000ms). Automatically clears the interval on
309
+ * component destroy.
310
+ *
311
+ * ```svelte
312
+ * <script>
313
+ * import { useCurrentTime } from '@bereasoftware/time-guard/svelte';
314
+ * const now = useCurrentTime({ interval: 1000 });
315
+ * <\/script>
316
+ * <p>{$now.format('HH:mm:ss')}</p>
317
+ * ```
318
+ */
319
+ function useCurrentTime(options) {
320
+ const interval = options?.interval ?? 1e3;
321
+ const config = options?.config;
322
+ const store = writable(TimeGuard.now(config), () => {
323
+ const timer = setInterval(() => {
324
+ store.set(TimeGuard.now(config));
325
+ }, interval);
326
+ return () => {
327
+ clearInterval(timer);
328
+ };
329
+ });
330
+ return { subscribe: store.subscribe };
331
+ }
332
+ /**
333
+ * Creates a readable store of a relative time string that recalculates
334
+ * periodically (default every 60s).
335
+ *
336
+ * ```svelte
337
+ * <script>
338
+ * import { useRelativeTime } from '@bereasoftware/time-guard/svelte';
339
+ * const relative = useRelativeTime('2026-05-20T08:00:00', { locale: 'es' });
340
+ * <\/script>
341
+ * <p>{$relative}</p>
342
+ * ```
343
+ */
344
+ function useRelativeTime(date, options) {
345
+ const interval = options?.interval ?? 6e4;
346
+ const locale = options?.locale;
347
+ const numeric = options?.numeric;
348
+ const compute = () => {
349
+ const tgDate = TimeGuard.from(date);
350
+ const now = TimeGuard.now();
351
+ return tgDate.since(now).humanize({
352
+ locale,
353
+ numeric
354
+ });
355
+ };
356
+ const store = writable(compute(), () => {
357
+ const timer = setInterval(() => {
358
+ store.set(compute());
359
+ }, interval);
360
+ return () => {
361
+ clearInterval(timer);
362
+ };
363
+ });
364
+ return { subscribe: store.subscribe };
365
+ }
366
+ /**
367
+ * Creates a readable store of a TimeRange instance.
368
+ * Recalculates reactively when `start` or `end` change (supports both
369
+ * plain values and Svelte stores).
370
+ *
371
+ * ```svelte
372
+ * <script>
373
+ * import { writable } from 'svelte/store';
374
+ * import { useTimeRange } from '@bereasoftware/time-guard/svelte';
375
+ *
376
+ * // Static range
377
+ * const range = useTimeRange('2026-05-20', '2026-06-01');
378
+ *
379
+ * // Reactive range
380
+ * const start = writable('2026-05-20');
381
+ * const end = writable('2026-06-01');
382
+ * const range2 = useTimeRange(start, end);
383
+ * <\/script>
384
+ *
385
+ * <p>Duration: {$range.toDuration().humanize()}</p>
386
+ */
387
+ function useTimeRange(start, end, config) {
388
+ return derived([toStore(start), toStore(end)], ([$start, $end]) => {
389
+ return new TimeRange(TimeGuard.from($start, config), TimeGuard.from($end, config));
390
+ });
391
+ }
392
+ //#endregion
393
+ export { TimeGuardConfigKey, useCurrentTime, useRelativeTime, useTimeGuard, useTimeRange };
@@ -0,0 +1,88 @@
1
+ import { Readable } from 'svelte/store';
2
+ import { TimeGuard, ITimeGuardConfig, TimeRange } from './core';
3
+ /**
4
+ * Injection-key symbol to retrieve a global TimeGuard configuration
5
+ * provided at the app root. Consumers use `getContext(TimeGuardConfigKey)`.
6
+ */
7
+ export declare const TimeGuardConfigKey: unique symbol;
8
+ /**
9
+ * Creates a reactive readable store of a TimeGuard instance.
10
+ * Automatically updates when `input` changes (supports both plain values
11
+ * and Svelte stores as input — pass a `Readable` for full reactivity).
12
+ * Integrates global config from `getContext(TimeGuardConfigKey)` as fallback.
13
+ *
14
+ * ```svelte
15
+ * <script>
16
+ * import { writable } from 'svelte/store';
17
+ * import { useTimeGuard } from '@bereasoftware/time-guard/svelte';
18
+ * import { TimeGuard } from '@bereasoftware/time-guard';
19
+ *
20
+ * // Static input — no reactivity needed
21
+ * const tg = useTimeGuard('2026-05-20');
22
+ *
23
+ * // Reactive input — pass a store
24
+ * const dateStore = writable('2026-05-20');
25
+ * const tg2 = useTimeGuard(dateStore);
26
+ * </script>
27
+ *
28
+ * <p>{$tg.format('dddd, DD MMMM YYYY')}</p>
29
+ * <p>{$tg2.format('dddd, DD MMMM YYYY')}</p>
30
+ * ```
31
+ */
32
+ export declare function useTimeGuard(input?: unknown | Readable<unknown>, config?: ITimeGuardConfig): Readable<TimeGuard>;
33
+ /**
34
+ * Creates a readable store of the current time that ticks on a specified
35
+ * interval (default 1000ms). Automatically clears the interval on
36
+ * component destroy.
37
+ *
38
+ * ```svelte
39
+ * <script>
40
+ * import { useCurrentTime } from '@bereasoftware/time-guard/svelte';
41
+ * const now = useCurrentTime({ interval: 1000 });
42
+ * </script>
43
+ * <p>{$now.format('HH:mm:ss')}</p>
44
+ * ```
45
+ */
46
+ export declare function useCurrentTime(options?: {
47
+ interval?: number;
48
+ config?: ITimeGuardConfig;
49
+ }): Readable<TimeGuard>;
50
+ /**
51
+ * Creates a readable store of a relative time string that recalculates
52
+ * periodically (default every 60s).
53
+ *
54
+ * ```svelte
55
+ * <script>
56
+ * import { useRelativeTime } from '@bereasoftware/time-guard/svelte';
57
+ * const relative = useRelativeTime('2026-05-20T08:00:00', { locale: 'es' });
58
+ * </script>
59
+ * <p>{$relative}</p>
60
+ * ```
61
+ */
62
+ export declare function useRelativeTime(date: unknown, options?: {
63
+ interval?: number;
64
+ locale?: string;
65
+ numeric?: 'always' | 'auto';
66
+ }): Readable<string>;
67
+ /**
68
+ * Creates a readable store of a TimeRange instance.
69
+ * Recalculates reactively when `start` or `end` change (supports both
70
+ * plain values and Svelte stores).
71
+ *
72
+ * ```svelte
73
+ * <script>
74
+ * import { writable } from 'svelte/store';
75
+ * import { useTimeRange } from '@bereasoftware/time-guard/svelte';
76
+ *
77
+ * // Static range
78
+ * const range = useTimeRange('2026-05-20', '2026-06-01');
79
+ *
80
+ * // Reactive range
81
+ * const start = writable('2026-05-20');
82
+ * const end = writable('2026-06-01');
83
+ * const range2 = useTimeRange(start, end);
84
+ * </script>
85
+ *
86
+ * <p>Duration: {$range.toDuration().humanize()}</p>
87
+ */
88
+ export declare function useTimeRange(start: unknown | Readable<unknown>, end: unknown | Readable<unknown>, config?: ITimeGuardConfig): Readable<TimeRange>;