@bereasoftware/time-guard 2.8.0 → 2.9.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 (40) hide show
  1. package/dist/adapters/temporal.adapter.d.ts +6 -2
  2. package/dist/angular/index.cjs +1 -1
  3. package/dist/angular/index.es.js +6 -3
  4. package/dist/calendars/index.es.js +1 -1
  5. package/dist/core-BDQnStek.cjs +1 -0
  6. package/dist/{core-Dxn1aRFk.js → core-GHK7isoa.js} +29 -15
  7. package/dist/locales/index.es.js +2 -2
  8. package/dist/{locales-3Mw99lQ-.js → locales-Dwe5oGoy.js} +1 -1
  9. package/dist/native/index.cjs +1 -1
  10. package/dist/native/index.es.js +3 -3
  11. package/dist/plugins/advanced-format/index.d.ts +8 -0
  12. package/dist/plugins/advanced-format.cjs +1 -1
  13. package/dist/plugins/advanced-format.es.js +11 -6
  14. package/dist/plugins/duration/index.d.ts +6 -0
  15. package/dist/plugins/duration.cjs +1 -1
  16. package/dist/plugins/duration.es.js +12 -8
  17. package/dist/plugins/manager.d.ts +6 -2
  18. package/dist/plugins/relative-time/index.d.ts +6 -0
  19. package/dist/plugins/relative-time.cjs +1 -1
  20. package/dist/plugins/relative-time.es.js +4 -1
  21. package/dist/qwik/index.cjs +1 -1
  22. package/dist/qwik/index.es.js +29 -26
  23. package/dist/qwik.d.ts +5 -1
  24. package/dist/react/index.cjs +1 -1
  25. package/dist/react/index.es.js +2 -2
  26. package/dist/solid/index.cjs +1 -1
  27. package/dist/solid/index.es.js +12 -10
  28. package/dist/solid.d.ts +5 -2
  29. package/dist/svelte/index.cjs +1 -1
  30. package/dist/svelte/index.es.js +2 -2
  31. package/dist/time-guard.cjs +1 -1
  32. package/dist/time-guard.es.js +3 -3
  33. package/dist/time-guard.iife.js +1 -1
  34. package/dist/time-guard.umd.js +1 -1
  35. package/dist/types/index.d.ts +10 -0
  36. package/dist/vue/index.cjs +1 -1
  37. package/dist/vue/index.es.js +33 -33
  38. package/dist/vue.d.ts +5 -3
  39. package/package.json +2 -2
  40. package/dist/core-TqmHKXY1.cjs +0 -1
@@ -57,9 +57,13 @@ export declare class TemporalAdapter {
57
57
  */
58
58
  static now(): TemporalPlainDateTime;
59
59
  /**
60
- * Get current time as ZonedDateTime with timezone
60
+ * Get current time as a ZonedDateTime, carrying real offset/zone info.
61
+ * With no `timezone`, uses the system's own default zone (still a real
62
+ * zone, not the offset-naive PlainDateTime `now()` above returns) —
63
+ * this is what TimeGuard.now() uses, so toISOString()/getOffset() can
64
+ * perform a genuine conversion instead of mislabeling local time as UTC.
61
65
  */
62
- static nowInTimezone(timezone: string): TemporalZonedDateTime;
66
+ static nowInTimezone(timezone?: string): TemporalZonedDateTime;
63
67
  /**
64
68
  * Compare two Temporal.PlainDateTime objects
65
69
  * Returns: -1 if dt1 < dt2, 0 if equal, 1 if dt1 > dt2
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../core-TqmHKXY1.cjs");let t=require("@angular/core"),n=require("rxjs");var r=new t.InjectionToken(`TIME_GUARD_CONFIG`),i=class{globalConfig=(0,t.inject)(r,{optional:!0});transform(t,n=`YYYY-MM-DD HH:mm:ss`,r){if(!t)return``;try{let i=e.i.from(t),a=r||this.globalConfig?.locale;return a?i.locale(a).format(n):i.format(n)}catch{return String(t)}}},a=class{globalConfig=(0,t.inject)(r,{optional:!0});transform(t,n,r){if(!t)return``;try{let i=e.i.from(t),a=e.i.now(),o=n||this.globalConfig?.locale;return i.since(a).humanize({locale:o,numeric:r})}catch{return String(t)}}},o=class{ngZone=(0,t.inject)(t.NgZone);globalConfig=(0,t.inject)(r,{optional:!0});getCurrentTime(t=1e3,r){let i=r??this.globalConfig??void 0;return new n.Observable(n=>this.ngZone.runOutsideAngular(()=>{n.next(e.i.now(i));let r=setInterval(()=>{this.ngZone.run(()=>{n.next(e.i.now(i))})},t);return()=>{clearInterval(r)}})).pipe((0,n.shareReplay)(1))}},s=class{latestValue=``;subscription;lastInput;lastPattern;lastInterval;lastLocale;cdr=(0,t.inject)(t.ChangeDetectorRef);timeGuardService=(0,t.inject)(o);globalConfig=(0,t.inject)(r,{optional:!0});transform(t,n=`YYYY-MM-DD HH:mm:ss`,r=1e3,i){if(!t)return``;if(t!==this.lastInput||n!==this.lastPattern||r!==this.lastInterval||i!==this.lastLocale){this.ngOnDestroy(),this.lastInput=t,this.lastPattern=n,this.lastInterval=r,this.lastLocale=i;let a=i||this.globalConfig?.locale;t===`now`?this.subscription=this.timeGuardService.getCurrentTime(r).subscribe(e=>{this.latestValue=a?e.locale(a).format(n):e.format(n),this.cdr.markForCheck()}):this.subscription=this.timeGuardService.getCurrentTime(r).subscribe(()=>{try{let r=e.i.from(t);this.latestValue=a?r.locale(a).format(n):r.format(n),this.cdr.markForCheck()}catch{this.latestValue=String(t)}})}return this.latestValue}ngOnDestroy(){this.subscription&&=(this.subscription.unsubscribe(),void 0)}};(0,t.Pipe)({name:`timeGuardFormat`,pure:!0})(i),(0,t.Pipe)({name:`timeGuardRelative`,pure:!1})(a),(0,t.Injectable)({providedIn:`root`})(o),(0,t.Pipe)({name:`timeGuardLiveFormat`,pure:!1})(s),exports.TIME_GUARD_CONFIG=r,exports.TimeGuardFormatPipe=i,exports.TimeGuardLiveFormatPipe=s,exports.TimeGuardRelativePipe=a,exports.TimeGuardService=o;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../core-BDQnStek.cjs");let t=require("@angular/core"),n=require("rxjs");var r=new t.InjectionToken(`TIME_GUARD_CONFIG`),i=class{globalConfig=(0,t.inject)(r,{optional:!0});transform(t,n=`YYYY-MM-DD HH:mm:ss`,r){if(!t)return``;try{let i=e.i.from(t),a=r||this.globalConfig?.locale;return a?i.locale(a).format(n):i.format(n)}catch{return String(t)}}},a=class{globalConfig=(0,t.inject)(r,{optional:!0});transform(t,n,r){if(!t)return``;try{let i=e.i.from(t),a=e.i.now(),o=n||this.globalConfig?.locale;return i.since(a).humanize({locale:o,numeric:r})}catch{return String(t)}}},o=class{ngZone=(0,t.inject)(t.NgZone);globalConfig=(0,t.inject)(r,{optional:!0});getCurrentTime(t=1e3,r){let i=r??this.globalConfig??void 0;return new n.Observable(n=>this.ngZone.runOutsideAngular(()=>{n.next(e.i.now(i));let r=setInterval(()=>{this.ngZone.run(()=>{n.next(e.i.now(i))})},t);return()=>{clearInterval(r)}})).pipe((0,n.shareReplay)(1))}},s=@((0,t.Pipe)({name:`timeGuardLiveFormat`,pure:!1})) class{latestValue=``;subscription;lastInput;lastPattern;lastInterval;lastLocale;cdr=(0,t.inject)(t.ChangeDetectorRef);timeGuardService=(0,t.inject)(o);globalConfig=(0,t.inject)(r,{optional:!0});transform(t,n=`YYYY-MM-DD HH:mm:ss`,r=1e3,i){if(!t)return``;if(t!==this.lastInput||n!==this.lastPattern||r!==this.lastInterval||i!==this.lastLocale){this.ngOnDestroy(),this.lastInput=t,this.lastPattern=n,this.lastInterval=r,this.lastLocale=i;let a=i||this.globalConfig?.locale;t===`now`?this.subscription=this.timeGuardService.getCurrentTime(r).subscribe(e=>{this.latestValue=a?e.locale(a).format(n):e.format(n),this.cdr.markForCheck()}):this.subscription=this.timeGuardService.getCurrentTime(r).subscribe(()=>{try{let r=e.i.from(t);this.latestValue=a?r.locale(a).format(n):r.format(n),this.cdr.markForCheck()}catch{this.latestValue=String(t)}})}return this.latestValue}ngOnDestroy(){this.subscription&&=(this.subscription.unsubscribe(),void 0)}};(0,t.Pipe)({name:`timeGuardFormat`,pure:!0})(i),(0,t.Pipe)({name:`timeGuardRelative`,pure:!1})(a),(0,t.Injectable)({providedIn:`root`})(o),(0,t.Pipe)({name:`timeGuardLiveFormat`,pure:!1})(s),exports.TIME_GUARD_CONFIG=r,exports.TimeGuardFormatPipe=i,exports.TimeGuardLiveFormatPipe=s,exports.TimeGuardRelativePipe=a,exports.TimeGuardService=o;
@@ -1,5 +1,5 @@
1
- /*! time-guard v2.8.0 | (c) 2026 Berea-Soft | MIT License | https://github.com/Berea-Soft/time-guard */
2
- import { i as e } from "../core-Dxn1aRFk.js";
1
+ /*! time-guard v2.9.0 | (c) 2026 Berea-Soft | MIT License | https://github.com/Berea-Soft/time-guard */
2
+ import { i as e } from "../core-GHK7isoa.js";
3
3
  import { ChangeDetectorRef as t, Injectable as n, InjectionToken as r, NgZone as i, Pipe as a, inject as o } from "@angular/core";
4
4
  import { Observable as s, shareReplay as c } from "rxjs";
5
5
  //#region src/angular.ts
@@ -45,7 +45,10 @@ var l = new r("TIME_GUARD_CONFIG"), u = class {
45
45
  };
46
46
  })).pipe(c(1));
47
47
  }
48
- }, p = class {
48
+ }, p = @a({
49
+ name: "timeGuardLiveFormat",
50
+ pure: !1
51
+ }) class {
49
52
  latestValue = "";
50
53
  subscription;
51
54
  lastInput;
@@ -1,4 +1,4 @@
1
- /*! time-guard v2.8.0 | (c) 2026 Berea-Soft | MIT License | https://github.com/Berea-Soft/time-guard */
1
+ /*! time-guard v2.9.0 | (c) 2026 Berea-Soft | MIT License | https://github.com/Berea-Soft/time-guard */
2
2
  //#region src/calendars/index.ts
3
3
  var e = class {
4
4
  id = "islamic";
@@ -0,0 +1 @@
1
+ const e=require("./locales-bc-5kDuZ.cjs");var t=null;function n(){if(t)return t;let e=globalThis.Temporal;if(!e)throw Error(`Temporal API not loaded. Make sure @js-temporal/polyfill is imported in your app.`);return t=e,e}var r=class{static parseToPlainDateTime(e){let t=n();return this.isPlainDateTime(e)?e:this.isZonedDateTime(e)?e.toPlainDateTime():this.isPlainDate(e)?e.toPlainDateTime({hour:0,minute:0,second:0,millisecond:0}):this.isPlainTime(e)?t.Now.plainDateTimeISO().withPlainTime(e):typeof e==`object`&&e&&`getTime`in e&&typeof e.getTime==`function`?this.fromDate(e):typeof e==`number`?this.fromUnix(e):typeof e==`string`?this.parseISOString(e):typeof e==`object`&&e?this.fromObject(e):t.Now.plainDateTimeISO()}static fromDate(e){let t=n(),[r,i]=e.toISOString().split(`T`);return t.PlainDateTime.from(r+`T`+i.slice(0,-1))}static fromUnix(e){return this.fromDate(new Date(e))}static parseISOString(e){let t=n();try{if(e.includes(`T`)||/ \d{2}:\d{2}/.test(e)){let n=e.replace(` `,`T`).replace(/(?:Z|[+-]\d{2}:\d{2})$/i,``);return t.PlainDateTime.from(n)}return t.PlainDate.from(e).toPlainDateTime({hour:0})}catch{return t.Now.plainDateTimeISO()}}static fromObject(e){let t=n(),r=e.year||t.Now.plainDateISO().year,i=e.month||1,a=e.day||1,o=e.hour||0,s=e.minute||0,c=e.second||0,l=e.millisecond||0;return t.PlainDateTime.from({year:this.toFiniteInteger(r),month:this.toFiniteInteger(i),day:this.toFiniteInteger(a),hour:this.toFiniteInteger(o),minute:this.toFiniteInteger(s),second:this.toFiniteInteger(c),millisecond:this.toFiniteInteger(l)})}static toDate(e){let t=this.toPlainDateTime(e);return new Date(t.toString())}static toUnix(e){let t=this.toPlainDateTime(e);return Date.UTC(t.year,t.month-1,t.day,t.hour,t.minute,t.second,t.millisecond)}static toISOString(e){return this.isZonedDateTime(e)?e.toInstant().toString({smallestUnit:`millisecond`}):this.toPlainDateTime(e).toString({smallestUnit:`millisecond`})+`Z`}static toPlainDateTime(e){return this.isPlainDateTime(e)?e:e.toPlainDateTime()}static isPlainDateTime(e){return typeof e==`object`&&!!e&&`year`in e&&`month`in e&&`day`in e&&`hour`in e&&!(`timeZoneId`in e)}static isZonedDateTime(e){return typeof e==`object`&&!!e&&`timeZoneId`in e}static isPlainDate(e){return typeof e==`object`&&!!e&&`year`in e&&`month`in e&&`day`in e&&!(`hour`in e)&&`toPlainDateTime`in e}static isPlainTime(e){return typeof e==`object`&&!!e&&`hour`in e&&!(`year`in e)}static toFiniteInteger(e){let t=Number(e);if(!Number.isFinite(t))throw Error(`Temporal error: Expected finite integer, got ${e}`);return Math.trunc(t)}static validatePlainDateTime(e){for(let t of[`year`,`month`,`day`,`hour`,`minute`,`second`,`millisecond`]){let n=e[t];if(typeof n!=`number`||!Number.isFinite(n)||!Number.isInteger(n))throw typeof console<`u`&&typeof console.error==`function`&&console.error(`TemporalAdapter.validatePlainDateTime: campo inválido`,t,n,e),Error(`Temporal error: Expected finite integer for ${t}, got ${n}`)}}static now(){return n().Now.plainDateTimeISO()}static nowInTimezone(e){return n().Now.zonedDateTimeISO(e)}static compare(e,t){let r=n();if(this.validatePlainDateTime(e),this.validatePlainDateTime(t),r.PlainDateTime&&typeof r.PlainDateTime.compare==`function`)return r.PlainDateTime.compare(e,t);let i=e.toString(),a=t.toString();return i<a?-1:+(i>a)}},i=class{localeManager;constructor(){this.localeManager=e.c.getInstance()}format(e,t,n){let r=this.localeManager.getLocale(n),i=[],a=t.replace(/\[([^\]]+)\]/g,(e,t)=>(i.push(t),`~${i.length-1}~`));a=a.replace(/"([^"]*)"/g,(e,t)=>(i.push(t),`~${i.length-1}~`));let o=a.replace(/Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|SSS/g,t=>{switch(t){case`YYYY`:return String(e.year).padStart(4,`0`);case`YY`:return String(e.year).slice(-2);case`Y`:return String(e.year);case`MMMM`:return r.months[e.month-1];case`MMM`:return r.monthsShort[e.month-1];case`MM`:return String(e.month).padStart(2,`0`);case`M`:return String(e.month);case`DD`:return String(e.day).padStart(2,`0`);case`D`:return String(e.day);case`dddd`:return r.weekdays[e.dayOfWeek%7];case`ddd`:return r.weekdaysShort[e.dayOfWeek%7];case`dd`:return r.weekdaysMin[e.dayOfWeek%7];case`d`:return String(e.dayOfWeek);case`HH`:return String(e.hour).padStart(2,`0`);case`H`:return String(e.hour);case`hh`:return String(e.hour%12||12).padStart(2,`0`);case`h`:return String(e.hour%12||12);case`mm`:return String(e.minute).padStart(2,`0`);case`m`:return String(e.minute);case`ss`:return String(e.second).padStart(2,`0`);case`s`:return String(e.second);case`SSS`:return String(e.millisecond).padStart(3,`0`);case`a`:case`A`:let n=r.meridiem||{am:`am`,pm:`pm`},i=e.hour>=12?n.pm:n.am;return t===`a`?i.toLowerCase():i.toUpperCase();default:return t}});return i.forEach((e,t)=>{o=o.replace(`~${t}~`,e)}),o}getPreset(e){let t={iso:`YYYY-MM-DDTHH:mm:ss.SSSZ`,date:`YYYY-MM-DD`,time:`HH:mm:ss`,datetime:`YYYY-MM-DD HH:mm:ss`,rfc2822:`ddd, DD MMM YYYY HH:mm:ss Z`,rfc3339:`YYYY-MM-DDTHH:mm:ssZ`,utc:`YYYY-MM-DDTHH:mm:ss[Z]`};return t[e]||t.iso}formatPreset(e,t,n){let r=this.getPreset(t);return this.format(e,r,n)}},a={en:{year:[`year`,`years`],month:[`month`,`months`],week:[`week`,`weeks`],day:[`day`,`days`],hour:[`hour`,`hours`],minute:[`minute`,`minutes`],second:[`second`,`seconds`],millisecond:[`millisecond`,`milliseconds`]},es:{year:[`año`,`años`],month:[`mes`,`meses`],week:[`semana`,`semanas`],day:[`día`,`días`],hour:[`hora`,`horas`],minute:[`minuto`,`minutos`],second:[`segundo`,`segundos`],millisecond:[`milisegundo`,`milisegundos`]},fr:{year:[`année`,`années`],month:[`mois`,`mois`],week:[`semaine`,`semaines`],day:[`jour`,`jours`],hour:[`heure`,`heures`],minute:[`minute`,`minutes`],second:[`seconde`,`secondes`],millisecond:[`milliseconde`,`millisecondes`]}},o={en:`and`,es:`y`,fr:`et`,de:`und`,it:`e`,pt:`e`};function s(e,t,n){return((a[t]||a.en)[e]||[e,e+`s`])[n===1?0:1]}function c(e){return o[e]||`and`}function l(e,t){if(e.length===0)return``;if(e.length===1)return e[0];let n=c(t);return e.length===2?`${e[0]} ${n} ${e[1]}`:e.slice(0,-1).join(`, `)+` ${n} ${e[e.length-1]}`}function u(e){return{en:`0 seconds`,es:`0 segundos`,fr:`0 secondes`}[e]||`0 seconds`}var d=class{id=`gregory`;name=`Gregorian Calendar`;locale=`en`;monthNames=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`];monthNamesShort=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`];weekdayNames=[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`];weekdayNamesShort=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`];getMonthName(e,t=!1){return(t?this.monthNamesShort:this.monthNames)[Math.max(0,Math.min(11,e-1))]}getWeekdayName(e,t=!1){return(t?this.weekdayNamesShort:this.weekdayNames)[Math.max(0,Math.min(6,e-1))]}isLeapYear(e){return e%4==0&&e%100!=0||e%400==0}daysInMonth(e,t){return t===2&&this.isLeapYear(e)?29:[31,28,31,30,31,30,31,31,30,31,30,31][Math.max(0,Math.min(11,t-1))]}daysInYear(e){return this.isLeapYear(e)?366:365}},f=class e{static instance;calendars=new Map;defaultCalendar=`gregory`;constructor(){this.register(new d)}static getInstance(){return e.instance||=new e,e.instance}register(e){this.calendars.has(e.id)&&console.warn(`Calendar "${e.id}" is already registered. Overwriting...`),this.calendars.set(e.id,e)}get(e){return this.calendars.get(e)}list(){return Array.from(this.calendars.keys())}setDefault(e){if(!this.calendars.has(e)){console.warn(`Calendar "${e}" is not registered. Keeping "${this.defaultCalendar}" as default.`);return}this.defaultCalendar=e}getDefault(){let e=this.calendars.get(this.defaultCalendar);if(!e)throw Error(`Default calendar '${this.defaultCalendar}' not found`);return e}},p=f.getInstance(),m=class e{static instance;plugins=new Map;static getInstance(){return e.instance||=new e,e.instance}static use(t,n,r){e.getInstance().register(t,n,r)}static useMultiple(t,n,r){let i=e.getInstance();t.forEach(e=>i.register(e,n,r))}static getPlugin(t){return e.getInstance().plugins.get(t)?.plugin}static hasPlugin(t){return e.getInstance().plugins.has(t)}static listPlugins(){let t=e.getInstance();return Array.from(t.plugins.keys())}static unuse(t){let n=e.getInstance(),r=n.plugins.get(t);return r?(r.plugin.uninstall?.(r.timeGuardClass),n.plugins.delete(t)):!1}static clear(){let t=e.getInstance();for(let e of t.plugins.values())e.plugin.uninstall?.(e.timeGuardClass);t.plugins.clear()}register(e,t,n){if(this.plugins.has(e.name)){console.warn(`Plugin "${e.name}" is already registered. Skipping...`);return}try{e.install(t,n),this.plugins.set(e.name,{plugin:e,timeGuardClass:t}),process.env.NODE_ENV!==`production`&&console.warn(`Plugin "${e.name}" v${e.version} registered successfully`)}catch(t){throw console.error(`Failed to register plugin "${e.name}":`,t),Error(`Failed to register plugin "${e.name}": ${t instanceof Error?t.message:String(t)}`)}}},h=1e3,g=h*60,_=g*60,v=_*24,y=v*7,b=365.25,x=b/12*v,S=b*v,C=` days`;function w(e){return(e.years||0)*S+(e.months||0)*x+(e.weeks||0)*y+(e.days||0)*v+(e.hours||0)*_+(e.minutes||0)*g+(e.seconds||0)*h+(e.milliseconds||0)}var T=class{_value;_tg1;_tg2;_mode;_breakdownData;_locale;constructor(e,t,n,r=`exact`,i,a){this._value=e,this._tg1=t,this._tg2=n,this._mode=r,this._breakdownData=i||null,this._locale=a||`en`}as(e){return this._tg1.diff(this._tg2,e)}breakdown(){return this._breakdownData}format(e){let t=e||this._locale;if(!this._breakdownData)return`${Math.abs(this._tg1.diff(this._tg2,`day`))}${C}`;let n=[],r=this._breakdownData;return r.years!==0&&n.push(`${r.years} ${s(`year`,t,r.years)}`),r.months!==0&&n.push(`${r.months} ${s(`month`,t,r.months)}`),r.weeks!==0&&n.push(`${r.weeks} ${s(`week`,t,r.weeks)}`),r.days!==0&&n.push(`${r.days} ${s(`day`,t,r.days)}`),r.hours!==0&&n.push(`${r.hours} ${s(`hour`,t,r.hours)}`),r.minutes!==0&&n.push(`${r.minutes} ${s(`minute`,t,r.minutes)}`),r.seconds!==0&&n.push(`${r.seconds} ${s(`second`,t,r.seconds)}`),n.length===0?u(t):l(n,t)}getMode(){return this._mode}valueOf(){return this._value}toString(){return this._mode===`calendar`&&this._breakdownData?this.format():this._value.toString()}toJSON(){return this._value}},E=class{years;months;weeks;days;hours;minutes;seconds;milliseconds;_locale;_startDate;_endDate;_steps=[];_mode=`exact`;_leapYearFlags=[];_calculationTimeMs=0;constructor(e,t=`en`,n){this.years=e.years,this.months=e.months,this.weeks=e.weeks,this.days=e.days,this.hours=e.hours,this.minutes=e.minutes,this.seconds=e.seconds,this.milliseconds=e.milliseconds,this._locale=t,n&&(this._startDate=n.startDate,this._endDate=n.endDate,this._steps=n.steps||[],this._mode=n.mode||`exact`,this._leapYearFlags=n.leapYearFlags||[],this._calculationTimeMs=n.calculationTimeMs||0)}humanize(e){let t=e?.locale||this._locale,n=e?.fullBreakdown??!1,r=e?.numeric??`always`,i=[{unit:`year`,value:this.years},{unit:`month`,value:this.months},{unit:`week`,value:this.weeks},{unit:`day`,value:this.days},{unit:`hour`,value:this.hours},{unit:`minute`,value:this.minutes},{unit:`second`,value:this.seconds},{unit:`millisecond`,value:this.milliseconds}].filter(e=>e.value!==0);if(i.length===0)return`0 seconds`;if(!n||i.length===1){let e=i[0];try{return new Intl.RelativeTimeFormat(t,{numeric:r,style:`long`}).format(e.value,e.unit)}catch{let n=Math.abs(e.value);return`${n} ${this.pluralizeUnit(e.unit,n,t)}`}}return l(i.map(e=>{let n=Math.abs(e.value);return`${n} ${s(e.unit,t,n)}`}),t)}total(e){let t=0;switch(t+=this.years*S,t+=this.months*x,t+=this.weeks*y,t+=this.days*v,t+=this.hours*_,t+=this.minutes*g,t+=this.seconds*h,t+=this.milliseconds,e){case`millisecond`:return t;case`second`:return t/h;case`minute`:return t/g;case`hour`:return t/_;case`day`:return t/v;case`week`:return t/y;case`month`:return t/x;case`year`:return t/S;case`microsecond`:return t*1e3;case`nanosecond`:return t*1e6;default:throw Error(`Unsupported unit: ${e}`)}}toString(){return this.humanize({fullBreakdown:!0})}toJSON(){return{years:this.years,months:this.months,weeks:this.weeks,days:this.days,hours:this.hours,minutes:this.minutes,seconds:this.seconds,milliseconds:this.milliseconds}}explain(){let e=[...this._steps];e.length===0&&(e=this.generateExplanationSteps());let t=[];if(this._startDate&&this._endDate&&t.push(`Calculated duration from ${this._startDate} to ${this._endDate}`),this._leapYearFlags&&this._leapYearFlags.length>0){let e=this._leapYearFlags.filter(e=>e.isLeap).map(e=>e.year);e.length>0&&t.push(`Leap year(s) detected: ${e.join(`, `)}`)}return t.push(`Breakdown: ${this.years} year(s), ${this.months} month(s), ${this.days} day(s)`),t.push(`Mode: ${this._mode} calculation`),{input:this._startDate&&this._endDate?[this._startDate,this._endDate]:[],steps:e,breakdown:{years:this.years,months:this.months,weeks:this.weeks,days:this.days,hours:this.hours,minutes:this.minutes,seconds:this.seconds,milliseconds:this.milliseconds},mode:this._mode,explanation:t.join(`. `),locale:this._locale,leapYearFlags:this._leapYearFlags.length>0?this._leapYearFlags:void 0,metadata:{calculationTimeMs:this._calculationTimeMs,precision:`day`}}}generateExplanationSteps(){let e=[];if(this._startDate&&this._endDate?e.push(`Input: ${this._startDate} to ${this._endDate}`):e.push(`Duration calculation started`),this.years>0&&e.push(`Years: ${this.years}`),this.months>0&&e.push(`Months: ${this.months}`),this.weeks>0&&e.push(`Weeks: ${this.weeks}`),this.days>0&&e.push(`Days: ${this.days}`),this.hours>0&&e.push(`Hours: ${this.hours}`),this.minutes>0&&e.push(`Minutes: ${this.minutes}`),this.seconds>0&&e.push(`Seconds: ${this.seconds}`),this.milliseconds>0&&e.push(`Milliseconds: ${this.milliseconds}`),this._leapYearFlags&&this._leapYearFlags.length>0)for(let t of this._leapYearFlags)t.isLeap&&e.push(`${t.year} is a leap year (February has ${t.daysInFebruary} days)`);let t=[this.years>0?`${this.years}y`:``,this.months>0?`${this.months}m`:``,this.days>0?`${this.days}d`:``,this.hours>0?`${this.hours}h`:``,this.minutes>0?`${this.minutes}min`:``,this.seconds>0?`${this.seconds}s`:``].filter(e=>e.length>0).join(` `);return e.push(`Total: ${t||`0`}`),e}pluralizeUnit(e,t,n){return s(e,n,t)}},D=class e{_start;_end;_ordered;constructor(e,t){this._start=e,this._end=t}get start(){return this._start}get end(){return this._end}getOrdered(){if(!this._ordered){let e=r.toPlainDateTime(this._start.toTemporal()),t=r.toPlainDateTime(this._end.toTemporal());this._ordered=r.compare(e,t)<=0?[e,t]:[t,e]}return this._ordered}toDuration(){return O.between(this._start,this._end)}inMonths(){return this.toDuration().total(`month`)}humanize(e){return this.toDuration().humanize(e)}in(e){return this.toDuration().total(e)}contains(e){let t=e instanceof O?e:new O(e),n=r.toPlainDateTime(t.toTemporal()),[i,a]=this.getOrdered();return r.compare(n,i)>=0&&r.compare(n,a)<=0}overlaps(e){let[t,n]=this.getOrdered(),[i,a]=e.getOrdered();return r.compare(t,a)<=0&&r.compare(i,n)<=0}intersect(t){if(!this.overlaps(t))return null;let[n,i]=this.getOrdered(),[a,o]=t.getOrdered(),s=r.compare(n,a)>=0?n:a,c=r.compare(i,o)<=0?i:o;return new e(O.fromTemporal(s,{locale:this._start.locale()}),O.fromTemporal(c,{locale:this._end.locale()}))}union(t){let[n,i]=this.getOrdered(),[a,o]=t.getOrdered(),s=r.compare(n,a)<=0?n:a,c=r.compare(i,o)>=0?i:o;return new e(O.fromTemporal(s,{locale:this._start.locale()}),O.fromTemporal(c,{locale:this._end.locale()}))}},O=class e{temporal;config;formatterInstance;static holidays=new Set;static registerHolidays(t){t.forEach(t=>{try{let n=new e(t);this.holidays.add(n.format(`YYYY-MM-DD`))}catch{}})}static clearHolidays(){this.holidays.clear()}static getRegisteredHolidays(){return Array.from(this.holidays).sort()}static ZERO_DURATION={years:0,months:0,weeks:0,days:0,hours:0,minutes:0,seconds:0,milliseconds:0};static isLeapYearValue(e){return e%4==0&&e%100!=0||e%400==0}static toDurationParts(e){return{years:Math.floor(e.years||0),months:Math.floor(e.months||0),weeks:Math.floor(e.weeks||0),days:Math.floor(e.days||0),hours:Math.floor(e.hours||0),minutes:Math.floor(e.minutes||0),seconds:Math.floor(e.seconds||0),milliseconds:Math.floor(e.milliseconds||0)}}constructor(t,n){if(this.formatterInstance=new i,this.config={locale:n?.locale||`en`,timezone:n?.timezone||`UTC`,strict:n?.strict??!1},t===void 0){this.temporal=r.nowInTimezone(n?.timezone);return}let a=t instanceof e?t.toTemporal():t;if(this.temporal=r.parseToPlainDateTime(a),this.config.timezone&&this.config.timezone!==`UTC`)try{let e=this.temporal.toZonedDateTime(this.config.timezone);this.temporal=e}catch{}}static now(t){return new e(void 0,t)}static from(t,n){return new e(t,n)}static fromTemporal(t,n){let r=new e(void 0,n);return r.temporal=t,r}static between(e,t){let n=r.toPlainDateTime(e.temporal),i=r.toPlainDateTime(t.temporal),[a,o]=r.compare(n,i)<=0?[e,t]:[t,e];return a.until(o)}static range(t,n){return new D(t instanceof e?t:new e(t),n instanceof e?n:new e(n))}toTemporal(){return this.temporal}toDate(){return r.toDate(this.temporal)}toISOString(){return r.toISOString(this.temporal)}valueOf(){return r.toUnix(this.temporal)}unix(){return Math.floor(this.valueOf()/1e3)}toJSON(){return this.toISOString()}[Symbol.toPrimitive](e){return e===`number`?this.valueOf():this.toISOString()}toString(){return this.format(`YYYY-MM-DD HH:mm:ss`)}locale(e){if(e===void 0)return this.config.locale;let t=this.clone();return t.config.locale=e,t}timezone(e){if(e===void 0)return this.config.timezone;let t=this.clone();t.config.timezone=e;try{t.temporal=r.toPlainDateTime(t.temporal).toZonedDateTime(e)}catch{}return t}format(e){let t=[`iso`,`date`,`time`,`datetime`,`rfc2822`,`rfc3339`,`utc`],n=[`iso`,`rfc2822`,`rfc3339`,`utc`].includes(e)&&r.isZonedDateTime(this.temporal)?this.temporal.toInstant().toZonedDateTimeISO(`UTC`).toPlainDateTime():r.toPlainDateTime(this.temporal),i=t.includes(e)?this.formatterInstance.getPreset(e):e;return this.formatterInstance.format(n,i,this.config.locale)}get(e){let t=r.toPlainDateTime(this.temporal);return e===`week`?t.weekOfYear:t[{year:`year`,month:`month`,day:`day`,hour:`hour`,minute:`minute`,second:`second`,millisecond:`millisecond`,microsecond:`microsecond`,nanosecond:`nanosecond`}[e]]}static UNIT_TO_PLURAL={year:`years`,month:`months`,week:`weeks`,day:`days`,hour:`hours`,minute:`minutes`,second:`seconds`,millisecond:`milliseconds`,microsecond:`microseconds`,nanosecond:`nanoseconds`,years:`years`,months:`months`,weeks:`weeks`,days:`days`,hours:`hours`,minutes:`minutes`,seconds:`seconds`,milliseconds:`milliseconds`,microseconds:`microseconds`,nanoseconds:`nanoseconds`};add(t){let n=r.toPlainDateTime(this.temporal),i={years:0,months:0,weeks:0,days:0,hours:0,minutes:0,seconds:0,milliseconds:0,microseconds:0,nanoseconds:0},a=!1;return Object.entries(t).forEach(([t,n])=>{if(n!==void 0&&n!==0){let r=Number(n);if(Number.isFinite(r)){let n=e.UNIT_TO_PLURAL[t]||t;i[n]=Math.trunc(r),a=!0}}}),a?(n=n.add(i),e.fromTemporal(n,this.config)):this}subtract(e){let t={};return Object.entries(e).forEach(([e,n])=>{t[e]=n?-n:0}),this.add(t)}diff(e,t){let n=r.toPlainDateTime(this.temporal),i=r.toPlainDateTime(e.temporal),a={year:`years`,month:`months`,week:`weeks`,day:`days`,hour:`hours`,minute:`minutes`,second:`seconds`,millisecond:`milliseconds`,microsecond:`microseconds`,nanosecond:`nanoseconds`};if(typeof t==`string`){let e=t,r=a[e],o=n.since(i,{largestUnit:e,smallestUnit:e});return Math.round(o[r]||0)}let o=t||{},s=o.mode||`exact`,c=o.unit||`millisecond`,l=o.locale||this.config.locale;if(s===`exact`){let r=a[c],o=n.since(i,{smallestUnit:c}),u=Math.round(o[r]||0);if(t===void 0||typeof t==`object`){let t=w(o);return new T(Math.round(t),this,e,s,void 0,l)}return u}if(s===`calendar`){let t=r.compare(n,i)<0,a=t?i:n,o=t?n:i,c=a.since(o,{largestUnit:`month`,smallestUnit:`millisecond`}),u={years:Math.floor(c.years||0),months:Math.floor(c.months||0),weeks:Math.floor(c.weeks||0),days:Math.floor(c.days||0),hours:Math.floor(c.hours||0),minutes:Math.floor(c.minutes||0),seconds:Math.floor(c.seconds||0),milliseconds:Math.floor(c.milliseconds||0)},d=w(c);return new T(Math.round(d),this,e,s,u,l)}let u=w(n.since(i,{smallestUnit:`millisecond`}));return new T(Math.round(u),this,e,s,void 0,l)}isBefore(e){let t=r.toPlainDateTime(this.temporal),n=r.toPlainDateTime(e.temporal);return r.compare(t,n)<0}isAfter(e){let t=r.toPlainDateTime(this.temporal),n=r.toPlainDateTime(e.temporal);return r.compare(t,n)>0}isSame(e,t){if(!t)return r.compare(r.toPlainDateTime(this.temporal),r.toPlainDateTime(e.temporal))===0;let n=r.toPlainDateTime(this.temporal),i=r.toPlainDateTime(e.temporal);switch(t){case`year`:return n.year===i.year;case`month`:return n.year===i.year&&n.month===i.month;case`day`:return n.year===i.year&&n.month===i.month&&n.day===i.day;case`hour`:return n.year===i.year&&n.month===i.month&&n.day===i.day&&n.hour===i.hour;case`minute`:return n.year===i.year&&n.month===i.month&&n.day===i.day&&n.hour===i.hour&&n.minute===i.minute;case`second`:return n.year===i.year&&n.month===i.month&&n.day===i.day&&n.hour===i.hour&&n.minute===i.minute&&n.second===i.second;default:return!1}}isBetween(e,t,n,i=`[]`){let a=r.toPlainDateTime(this.temporal),o=r.toPlainDateTime(e.temporal),s=r.toPlainDateTime(t.temporal),c=!0,l=!0;if(n){let e=this.clone().startOf(n),t=this.clone().endOf(n),i=r.toPlainDateTime(e.temporal),a=r.toPlainDateTime(t.temporal);c=r.compare(i,o)>=0,l=r.compare(a,s)<=0}else c=r.compare(a,o)>=0,l=r.compare(a,s)<=0;let u=i[0]===`[`,d=i[1]===`]`;return(u?c:r.compare(a,o)>0)&&(d?l:r.compare(a,s)<0)}clone(){return e.fromTemporal(this.temporal,this.config)}startOf(t){let n=r.toPlainDateTime(this.temporal),i={};switch(t){case`year`:i.month=1,i.day=1,i.hour=0,i.minute=0,i.second=0,i.millisecond=0;break;case`month`:i.day=1,i.hour=0,i.minute=0,i.second=0,i.millisecond=0;break;case`week`:case`day`:i.hour=0,i.minute=0,i.second=0,i.millisecond=0;break;case`hour`:i.minute=0,i.second=0,i.millisecond=0;break;case`minute`:i.second=0,i.millisecond=0;break;case`second`:i.millisecond=0;break}let a=n.with(i);return e.fromTemporal(a,this.config)}endOf(e){return this.startOf(e).add({[e]:1}).subtract({millisecond:1})}set(t){let n=r.toPlainDateTime(this.temporal).with(t);return e.fromTemporal(n,this.config)}year(){return r.toPlainDateTime(this.temporal).year}month(){return r.toPlainDateTime(this.temporal).month}day(){return r.toPlainDateTime(this.temporal).day}hour(){return r.toPlainDateTime(this.temporal).hour}minute(){return r.toPlainDateTime(this.temporal).minute}second(){return r.toPlainDateTime(this.temporal).second}millisecond(){return r.toPlainDateTime(this.temporal).millisecond}dayOfWeek(){return r.toPlainDateTime(this.temporal).dayOfWeek}dayOfYear(){return r.toPlainDateTime(this.temporal).dayOfYear}weekOfYear(){return r.toPlainDateTime(this.temporal).weekOfYear}daysInMonth(){return r.toPlainDateTime(this.temporal).add({months:1}).with({day:1}).subtract({days:1}).day}daysInYear(){let t=this.year();return e.isLeapYearValue(t)?366:365}inLeapYear(){let t=r.toPlainDateTime(this.temporal);return e.isLeapYearValue(t.year)}until(t,n){let i=r.toPlainDateTime(this.temporal),a=r.toPlainDateTime(t.temporal),o=performance.now();try{let t={largestUnit:n?.largestUnit||`year`};n?.smallestUnit&&(t.smallestUnit=n.smallestUnit);let r=a.since(i,t),s=e.toDurationParts(r),c=i.year,l=a.year,u=[];for(let t=c;t<=l;t++){let n=e.isLeapYearValue(t);u.push({year:t,isLeap:n,daysInFebruary:n?29:28})}let d=this.generateUntilSteps(i,a,s,u),f=performance.now()-o;return new E(s,this.config.locale,{startDate:i.toString(),endDate:a.toString(),steps:d,mode:`exact`,leapYearFlags:u.filter(e=>e.isLeap),calculationTimeMs:f})}catch{return new E(e.ZERO_DURATION,this.config.locale,{startDate:i.toString(),endDate:a.toString(),steps:[`Calculation failed, returning zero duration`],mode:`estimated`})}}generateUntilSteps(t,n,r,i){let a=[];a.push(`Parsed dates: ${t.year}-${String(t.month).padStart(2,`0`)}-${String(t.day).padStart(2,`0`)} (day ${t.dayOfYear} of ${e.isLeapYearValue(t.year)?366:365})`),a.push(`to ${n.year}-${String(n.month).padStart(2,`0`)}-${String(n.day).padStart(2,`0`)} (day ${n.dayOfYear} of ${e.isLeapYearValue(n.year)?366:365})`);let o=i.filter(e=>e.isLeap);if(o.length>0)for(let e of o)a.push(`${e.year} is a leap year (February has ${e.daysInFebruary} days)`);if(r.years>0&&a.push(`Years: ${r.years}`),r.months>0&&a.push(`Months: ${r.months}`),r.days>0&&a.push(`Days: ${r.days}`),r.hours>0||r.minutes>0||r.seconds>0){let e=[];r.hours>0&&e.push(`${r.hours}h`),r.minutes>0&&e.push(`${r.minutes}m`),r.seconds>0&&e.push(`${r.seconds}s`),a.push(`Time: ${e.join(` `)}`)}let s=r.years*365.25+r.months*30.4375+r.days+r.hours/24;return a.push(`Total: approximately ${s.toFixed(2)} days`),a}round(e={}){let{smallestUnit:t=`millisecond`,roundingMode:n=`halfExpand`}=e,i=r.toPlainDateTime(this.temporal),a={year:i.year,month:i.month,day:i.day,hour:i.hour,minute:i.minute,second:i.second,millisecond:i.millisecond,microsecond:i.microsecond||0,nanosecond:i.nanosecond||0,week:0},o=[`year`,`month`,`day`,`hour`,`minute`,`second`,`millisecond`,`microsecond`,`nanosecond`],s=o.indexOf(t);if(s===-1)return this.clone();let c={};for(let e=0;e<s;e++){let t=o[e];c[t]=a[t]}let l=o[s],u=a[l];s+1<o.length&&((e,t)=>{switch(e){case`ceil`:return t>0;case`floor`:case`trunc`:return!1;case`halfExpand`:case`halfFloor`:case`halfCeil`:return t>=5;case`expand`:return t>0;default:return t>=5}})(n,a[o[s+1]])&&(u+=1),c[l]=u;for(let e=s+1;e<o.length;e++)c[o[e]]=0;return this.set(c)}toPlainDate(){let e=r.toPlainDateTime(this.temporal);return{year:e.year,month:e.month,day:e.day,dayOfWeek:e.dayOfWeek}}toPlainTime(){let e=r.toPlainDateTime(this.temporal);return{hour:e.hour,minute:e.minute,second:e.second,millisecond:e.millisecond}}withDate(e,t,n){return this.set({year:e,month:t,day:n})}withTime(e,t=0,n=0,r=0){return this.set({hour:e,minute:t,second:n,millisecond:r})}getOffset(){return this.temporal?.offset||`Z`}getOffsetNanoseconds(){return this.temporal?.offsetNanoseconds||0}getTimeZoneId(){return this.temporal?.timeZoneId||null}startOfDay(){return this.startOf(`day`)}endOfDay(){return this.endOf(`day`)}since(t,n){let i=r.toPlainDateTime(this.temporal),a=r.toPlainDateTime(t.temporal),o=performance.now();try{let t={largestUnit:n?.largestUnit||`year`};n?.smallestUnit&&(t.smallestUnit=n.smallestUnit);let r=i.since(a,t),s=e.toDurationParts(r),c=a.year,l=i.year,u=[];for(let t=c;t<=l;t++){let n=e.isLeapYearValue(t);u.push({year:t,isLeap:n,daysInFebruary:n?29:28})}let d=this.generateUntilSteps(a,i,s,u),f=performance.now()-o;return new E(s,this.config.locale,{startDate:a.toString(),endDate:i.toString(),steps:d,mode:`exact`,leapYearFlags:u.filter(e=>e.isLeap),calculationTimeMs:f})}catch{return new E(e.ZERO_DURATION,this.config.locale,{startDate:a.toString(),endDate:i.toString(),steps:[`Calculation failed, returning zero duration`],mode:`estimated`})}}toDurationString(t){let n=t?this.until(t):this.until(e.now()),r=[];n.years&&r.push(`${n.years}Y`),n.months&&r.push(`${n.months}M`),n.days&&r.push(`${n.days}D`);let i=[];n.hours&&i.push(`${n.hours}H`),n.minutes&&i.push(`${n.minutes}M`),n.seconds&&i.push(`${n.seconds}S`);let a=`P${r.join(``)}${i.length>0?`T`+i.join(``):``}`;return a===`P`?`PT0S`:a}isPast(){return this.isBefore(e.now())}isFuture(){return this.isAfter(e.now())}isToday(){return this.isSame(e.now(),`day`)}isTomorrow(){return this.isSame(e.now().add({day:1}),`day`)}isYesterday(){return this.isSame(e.now().subtract({day:1}),`day`)}isWeekend(){let e=r.toPlainDateTime(this.temporal);return e.dayOfWeek===6||e.dayOfWeek===7}isHoliday(){let t=String(this.get(`year`)).padStart(4,`0`),n=String(this.get(`month`)).padStart(2,`0`),r=String(this.get(`day`)).padStart(2,`0`);return e.holidays.has(`${t}-${n}-${r}`)}isBusinessDay(){return!this.isWeekend()&&!this.isHoliday()}addBusinessDays(e){let t=Math.trunc(e);if(!Number.isFinite(t)||t===0)return this;let n=this.clone(),r=Math.abs(t),i=t>0?1:-1;for(;r>0;)n=n.add({day:i}),n.isBusinessDay()&&r--;return n}subtractBusinessDays(e){return this.addBusinessDays(-e)}},k=1e3,A=6e4;function j(e,t){let n=O.from(e),r=O.now();return n.since(r).humanize(t)}function M(e,t,n){return new D(O.from(e,n),O.from(t,n))}function N(e,t){return new O(e,t)}var P=`2.9.0`;Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return N}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return P}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return k}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return m}});
@@ -1,5 +1,5 @@
1
- /*! time-guard v2.8.0 | (c) 2026 Berea-Soft | MIT License | https://github.com/Berea-Soft/time-guard */
2
- import { c as e } from "./locales-3Mw99lQ-.js";
1
+ /*! time-guard v2.9.0 | (c) 2026 Berea-Soft | MIT License | https://github.com/Berea-Soft/time-guard */
2
+ import { c as e } from "./locales-Dwe5oGoy.js";
3
3
  //#region src/adapters/temporal.adapter.ts
4
4
  var t = null;
5
5
  function n() {
@@ -58,16 +58,16 @@ var r = class {
58
58
  return Date.UTC(t.year, t.month - 1, t.day, t.hour, t.minute, t.second, t.millisecond);
59
59
  }
60
60
  static toISOString(e) {
61
- return this.toPlainDateTime(e).toString({ smallestUnit: "millisecond" }) + "Z";
61
+ return this.isZonedDateTime(e) ? e.toInstant().toString({ smallestUnit: "millisecond" }) : this.toPlainDateTime(e).toString({ smallestUnit: "millisecond" }) + "Z";
62
62
  }
63
63
  static toPlainDateTime(e) {
64
64
  return this.isPlainDateTime(e) ? e : e.toPlainDateTime();
65
65
  }
66
66
  static isPlainDateTime(e) {
67
- return typeof e == "object" && !!e && "year" in e && "month" in e && "day" in e && "hour" in e;
67
+ return typeof e == "object" && !!e && "year" in e && "month" in e && "day" in e && "hour" in e && !("timeZoneId" in e);
68
68
  }
69
69
  static isZonedDateTime(e) {
70
- return typeof e == "object" && !!e && "timeZone" in e;
70
+ return typeof e == "object" && !!e && "timeZoneId" in e;
71
71
  }
72
72
  static isPlainDate(e) {
73
73
  return typeof e == "object" && !!e && "year" in e && "month" in e && "day" in e && !("hour" in e) && "toPlainDateTime" in e;
@@ -351,7 +351,7 @@ var d = class {
351
351
  t.forEach((e) => i.register(e, n, r));
352
352
  }
353
353
  static getPlugin(t) {
354
- return e.getInstance().plugins.get(t);
354
+ return e.getInstance().plugins.get(t)?.plugin;
355
355
  }
356
356
  static hasPlugin(t) {
357
357
  return e.getInstance().plugins.has(t);
@@ -361,10 +361,13 @@ var d = class {
361
361
  return Array.from(t.plugins.keys());
362
362
  }
363
363
  static unuse(t) {
364
- return e.getInstance().plugins.delete(t);
364
+ let n = e.getInstance(), r = n.plugins.get(t);
365
+ return r ? (r.plugin.uninstall?.(r.timeGuardClass), n.plugins.delete(t)) : !1;
365
366
  }
366
367
  static clear() {
367
- e.getInstance().plugins.clear();
368
+ let t = e.getInstance();
369
+ for (let e of t.plugins.values()) e.plugin.uninstall?.(e.timeGuardClass);
370
+ t.plugins.clear();
368
371
  }
369
372
  register(e, t, n) {
370
373
  if (this.plugins.has(e.name)) {
@@ -372,7 +375,10 @@ var d = class {
372
375
  return;
373
376
  }
374
377
  try {
375
- e.install(t, n), this.plugins.set(e.name, e), process.env.NODE_ENV !== "production" && console.warn(`Plugin "${e.name}" v${e.version} registered successfully`);
378
+ e.install(t, n), this.plugins.set(e.name, {
379
+ plugin: e,
380
+ timeGuardClass: t
381
+ }), process.env.NODE_ENV !== "production" && console.warn(`Plugin "${e.name}" v${e.version} registered successfully`);
376
382
  } catch (t) {
377
383
  throw console.error(`Failed to register plugin "${e.name}":`, t), Error(`Failed to register plugin "${e.name}": ${t instanceof Error ? t.message : String(t)}`);
378
384
  }
@@ -659,11 +665,14 @@ var T = class {
659
665
  };
660
666
  }
661
667
  constructor(t, n) {
662
- this.formatterInstance = new i(), this.config = {
668
+ if (this.formatterInstance = new i(), this.config = {
663
669
  locale: n?.locale || "en",
664
670
  timezone: n?.timezone || "UTC",
665
671
  strict: n?.strict ?? !1
666
- };
672
+ }, t === void 0) {
673
+ this.temporal = r.nowInTimezone(n?.timezone);
674
+ return;
675
+ }
667
676
  let a = t instanceof e ? t.toTemporal() : t;
668
677
  if (this.temporal = r.parseToPlainDateTime(a), this.config.timezone && this.config.timezone !== "UTC") try {
669
678
  let e = this.temporal.toZonedDateTime(this.config.timezone);
@@ -726,7 +735,7 @@ var T = class {
726
735
  return t;
727
736
  }
728
737
  format(e) {
729
- let t = r.toPlainDateTime(this.temporal), n = [
738
+ let t = [
730
739
  "iso",
731
740
  "date",
732
741
  "time",
@@ -734,8 +743,13 @@ var T = class {
734
743
  "rfc2822",
735
744
  "rfc3339",
736
745
  "utc"
737
- ].includes(e) ? this.formatterInstance.getPreset(e) : e;
738
- return this.formatterInstance.format(t, n, this.config.locale);
746
+ ], n = [
747
+ "iso",
748
+ "rfc2822",
749
+ "rfc3339",
750
+ "utc"
751
+ ].includes(e) && r.isZonedDateTime(this.temporal) ? this.temporal.toInstant().toZonedDateTimeISO("UTC").toPlainDateTime() : r.toPlainDateTime(this.temporal), i = t.includes(e) ? this.formatterInstance.getPreset(e) : e;
752
+ return this.formatterInstance.format(n, i, this.config.locale);
739
753
  }
740
754
  get(e) {
741
755
  let t = r.toPlainDateTime(this.temporal);
@@ -1181,6 +1195,6 @@ function M(e, t, n) {
1181
1195
  function N(e, t) {
1182
1196
  return new O(e, t);
1183
1197
  }
1184
- var P = "2.8.0";
1198
+ var P = "2.9.0";
1185
1199
  //#endregion
1186
1200
  export { D as a, N as c, f as d, d as f, r as h, O as i, P as l, i as m, k as n, j as o, p, E as r, M as s, A as t, m as u };
@@ -1,3 +1,3 @@
1
- /*! time-guard v2.8.0 | (c) 2026 Berea-Soft | MIT License | https://github.com/Berea-Soft/time-guard */
2
- import { a as e, i as t, n, r, t as i } from "../locales-3Mw99lQ-.js";
1
+ /*! time-guard v2.9.0 | (c) 2026 Berea-Soft | MIT License | https://github.com/Berea-Soft/time-guard */
2
+ import { a as e, i as t, n, r, t as i } from "../locales-Dwe5oGoy.js";
3
3
  export { i as ALL_LOCALES, n as LOCALES_COUNT, r as getAvailableLocales, t as loadAllLocales, e as registerAllLocales };
@@ -1,4 +1,4 @@
1
- /*! time-guard v2.8.0 | (c) 2026 Berea-Soft | MIT License | https://github.com/Berea-Soft/time-guard */
1
+ /*! time-guard v2.9.0 | (c) 2026 Berea-Soft | MIT License | https://github.com/Berea-Soft/time-guard */
2
2
  //#region src/locales/locale.manager.ts
3
3
  var e = {
4
4
  name: "en",
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../core-TqmHKXY1.cjs"),t=require("../locales-bc-5kDuZ.cjs"),n=require("../calendars/index.cjs"),r=require("../plugins/relative-time.cjs"),i=require("../plugins/duration.cjs"),a=require("../plugins/advanced-format.cjs");exports.ALL_LOCALES=t.t,exports.AdvancedFormatPlugin=a.AdvancedFormatPlugin,exports.BuddhistCalendar=n.BuddhistCalendar,exports.CalendarManager=e.d,exports.ChineseCalendar=n.ChineseCalendar,exports.DEFAULT_RELATIVE_INTERVAL_MS=e.t,exports.DEFAULT_TICK_INTERVAL_MS=e.n,exports.DateFormatter=e.m,exports.Duration=i.Duration,exports.DurationPlugin=i.DurationPlugin,exports.DurationResult=e.r,exports.EN_LOCALE=t.o,exports.ES_LOCALE=t.s,exports.GregorianCalendar=e.f,exports.HebrewCalendar=n.HebrewCalendar,exports.IslamicCalendar=n.IslamicCalendar,exports.JapaneseCalendar=n.JapaneseCalendar,exports.LOCALES_COUNT=t.n,exports.LocaleManager=t.c,exports.PluginManager=e.u,exports.RelativeTimePlugin=r.RelativeTimePlugin,exports.TemporalAdapter=e.h,exports.TimeGuard=e.i,exports.TimeRange=e.a,exports.advancedFormatPlugin=a.default,exports.calendarManager=e.p,exports.computeRelativeTime=e.o,exports.createTimeRangeFrom=e.s,exports.durationPlugin=i.default,exports.getAvailableLocales=t.r,exports.loadAllLocales=t.i,exports.registerAllLocales=t.a,exports.relativeTimePlugin=r.default,exports.timeGuard=e.c,exports.version=e.l;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../core-BDQnStek.cjs"),t=require("../locales-bc-5kDuZ.cjs"),n=require("../calendars/index.cjs"),r=require("../plugins/relative-time.cjs"),i=require("../plugins/duration.cjs"),a=require("../plugins/advanced-format.cjs");exports.ALL_LOCALES=t.t,exports.AdvancedFormatPlugin=a.AdvancedFormatPlugin,exports.BuddhistCalendar=n.BuddhistCalendar,exports.CalendarManager=e.d,exports.ChineseCalendar=n.ChineseCalendar,exports.DEFAULT_RELATIVE_INTERVAL_MS=e.t,exports.DEFAULT_TICK_INTERVAL_MS=e.n,exports.DateFormatter=e.m,exports.Duration=i.Duration,exports.DurationPlugin=i.DurationPlugin,exports.DurationResult=e.r,exports.EN_LOCALE=t.o,exports.ES_LOCALE=t.s,exports.GregorianCalendar=e.f,exports.HebrewCalendar=n.HebrewCalendar,exports.IslamicCalendar=n.IslamicCalendar,exports.JapaneseCalendar=n.JapaneseCalendar,exports.LOCALES_COUNT=t.n,exports.LocaleManager=t.c,exports.PluginManager=e.u,exports.RelativeTimePlugin=r.RelativeTimePlugin,exports.TemporalAdapter=e.h,exports.TimeGuard=e.i,exports.TimeRange=e.a,exports.advancedFormatPlugin=a.default,exports.calendarManager=e.p,exports.computeRelativeTime=e.o,exports.createTimeRangeFrom=e.s,exports.durationPlugin=i.default,exports.getAvailableLocales=t.r,exports.loadAllLocales=t.i,exports.registerAllLocales=t.a,exports.relativeTimePlugin=r.default,exports.timeGuard=e.c,exports.version=e.l;
@@ -1,6 +1,6 @@
1
- /*! time-guard v2.8.0 | (c) 2026 Berea-Soft | MIT License | https://github.com/Berea-Soft/time-guard */
2
- import { a as e, c as t, d as n, f as r, h as i, i as a, l as o, m as s, n as c, o as l, p as u, r as d, s as f, t as p, u as m } from "../core-Dxn1aRFk.js";
3
- import { a as h, c as g, i as _, n as v, o as y, r as b, s as x, t as S } from "../locales-3Mw99lQ-.js";
1
+ /*! time-guard v2.9.0 | (c) 2026 Berea-Soft | MIT License | https://github.com/Berea-Soft/time-guard */
2
+ import { a as e, c as t, d as n, f as r, h as i, i as a, l as o, m as s, n as c, o as l, p as u, r as d, s as f, t as p, u as m } from "../core-GHK7isoa.js";
3
+ import { a as h, c as g, i as _, n as v, o as y, r as b, s as x, t as S } from "../locales-Dwe5oGoy.js";
4
4
  import { BuddhistCalendar as C, ChineseCalendar as w, HebrewCalendar as T, IslamicCalendar as E, JapaneseCalendar as D } from "../calendars/index.es.js";
5
5
  import O, { RelativeTimePlugin as k } from "../plugins/relative-time.es.js";
6
6
  import A, { Duration as j, DurationPlugin as M } from "../plugins/duration.es.js";
@@ -3,10 +3,18 @@ import { TimeGuard } from '../../index';
3
3
  export declare class AdvancedFormatPlugin implements ITimeGuardPlugin {
4
4
  name: string;
5
5
  version: string;
6
+ private originalFormats;
6
7
  /**
7
8
  * Install plugin into TimeGuard
8
9
  */
9
10
  install(TimeGuardClass: typeof TimeGuard): void;
11
+ /**
12
+ * Reverse install() — restores format() to exactly what it was before
13
+ * this plugin wrapped it, instead of leaving the wrapper in place
14
+ * (which is what caused re-registration after clear() to stack a
15
+ * second wrapper on top of the first).
16
+ */
17
+ uninstall(TimeGuardClass: typeof TimeGuard): void;
10
18
  }
11
19
  /**
12
20
  * Create and export default instance
@@ -1 +1 @@
1
- Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});var e=class{name=`advanced-format`;version=`1.0.0`;install(e){let t=e.prototype.format;e.prototype.format=function(e){if(!e||typeof e!=`string`||!/Q|Do|w|W|gggg|GGGG|k{1,2}|X|x|zzz?/.test(e))return t.call(this,e);let n=this.toTemporal(),r=`toPlainDateTime`in n?n.toPlainDateTime():n,i=e=>{let t=[`th`,`st`,`nd`,`rd`],n=e%100;return e+(t[(n-20)%10]||t[n]||t[0])},a=(e,t)=>String(e).padStart(t,`0`),o=e=>{let t=new Date(e.year,0,4),n=new Date(t);n.setDate(t.getDate()-t.getDay()+(t.getDay()===0?-6:1));let r=new Date(e.year,e.month-1,e.day),i=Math.floor((r.getTime()-n.getTime())/(10080*60*1e3))+1;return Math.max(1,i)},s=e=>{let t=Math.ceil((e.day+new Date(e.year,e.month-1,1).getDay())/7);return Math.max(1,t)},c=e=>{let t=new Date(e.year,e.month-1,e.day),n=t.getTime()<new Date(e.year,0,1).getTime()?-1:+(t.getTime()>=new Date(e.year+1,0,1).getTime());return e.year+n},l=e=>{let t=e.month===1&&e.day<4?-1:+(e.month===12&&e.day>28);return e.year+t},u=e.replace(/Q|Do|w|W|gggg|GGGG|k{1,2}|X|x|zzz?/g,e=>{let t=``;switch(e){case`Q`:t=String(Math.ceil(r.month/3));break;case`Do`:t=i(r.day);break;case`W`:case`WW`:t=a(o(r),e===`W`?1:2);break;case`w`:case`ww`:t=a(s(r),e===`w`?1:2);break;case`GGGG`:t=String(c(r));break;case`gggg`:t=String(l(r));break;case`k`:case`kk`:t=a(r.hour===0?24:r.hour,e===`k`?1:2);break;case`X`:t=String(Math.floor(this.valueOf()/1e3));break;case`x`:t=String(this.valueOf());break;case`z`:t=`${this.getTimezoneOffset()}`;break;case`zzz`:t=`${this.getTimezoneOffsetLong()}`;break;default:return e}return`[${t}]`});return t.call(this,u)}}},t=new e;exports.AdvancedFormatPlugin=e,exports.default=t;
1
+ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});var e=class{name=`advanced-format`;version=`1.0.0`;originalFormats=new WeakMap;install(e){let t=e.prototype.format;this.originalFormats.set(e,t),e.prototype.format=function(e){if(!e||typeof e!=`string`||!/Q|Do|w|W|gggg|GGGG|k{1,2}|X|x|zzz|z/.test(e))return t.call(this,e);let n=this.toTemporal(),r=`toPlainDateTime`in n?n.toPlainDateTime():n,i=e=>{let t=[`th`,`st`,`nd`,`rd`],n=e%100;return e+(t[(n-20)%10]||t[n]||t[0])},a=(e,t)=>String(e).padStart(t,`0`),o=e=>{let t=new Date(e.year,0,4),n=new Date(t);n.setDate(t.getDate()-t.getDay()+(t.getDay()===0?-6:1));let r=new Date(e.year,e.month-1,e.day),i=Math.floor((r.getTime()-n.getTime())/(10080*60*1e3))+1;return Math.max(1,i)},s=e=>{let t=Math.ceil((e.day+new Date(e.year,e.month-1,1).getDay())/7);return Math.max(1,t)},c=e=>{let t=new Date(e.year,e.month-1,e.day),n=t.getTime()<new Date(e.year,0,1).getTime()?-1:+(t.getTime()>=new Date(e.year+1,0,1).getTime());return e.year+n},l=e=>{let t=e.month===1&&e.day<4?-1:+(e.month===12&&e.day>28);return e.year+t},u=e.replace(/Q|Do|w|W|gggg|GGGG|k{1,2}|X|x|zzz|z/g,e=>{let t=``;switch(e){case`Q`:t=String(Math.ceil(r.month/3));break;case`Do`:t=i(r.day);break;case`W`:case`WW`:t=a(o(r),e===`W`?1:2);break;case`w`:case`ww`:t=a(s(r),e===`w`?1:2);break;case`GGGG`:t=String(c(r));break;case`gggg`:t=String(l(r));break;case`k`:case`kk`:t=a(r.hour===0?24:r.hour,e===`k`?1:2);break;case`X`:t=String(Math.floor(this.valueOf()/1e3));break;case`x`:t=String(this.valueOf());break;case`z`:t=this.getOffset();break;case`zzz`:t=this.getTimeZoneId()??``;break;default:return e}return`[${t}]`});return t.call(this,u)}}uninstall(e){let t=this.originalFormats.get(e);t&&(e.prototype.format=t,this.originalFormats.delete(e))}},t=new e;exports.AdvancedFormatPlugin=e,exports.default=t;
@@ -1,12 +1,13 @@
1
- /*! time-guard v2.8.0 | (c) 2026 Berea-Soft | MIT License | https://github.com/Berea-Soft/time-guard */
1
+ /*! time-guard v2.9.0 | (c) 2026 Berea-Soft | MIT License | https://github.com/Berea-Soft/time-guard */
2
2
  //#region src/plugins/advanced-format/index.ts
3
3
  var e = class {
4
4
  name = "advanced-format";
5
5
  version = "1.0.0";
6
+ originalFormats = /* @__PURE__ */ new WeakMap();
6
7
  install(e) {
7
8
  let t = e.prototype.format;
8
- e.prototype.format = function(e) {
9
- if (!e || typeof e != "string" || !/Q|Do|w|W|gggg|GGGG|k{1,2}|X|x|zzz?/.test(e)) return t.call(this, e);
9
+ this.originalFormats.set(e, t), e.prototype.format = function(e) {
10
+ if (!e || typeof e != "string" || !/Q|Do|w|W|gggg|GGGG|k{1,2}|X|x|zzz|z/.test(e)) return t.call(this, e);
10
11
  let n = this.toTemporal(), r = "toPlainDateTime" in n ? n.toPlainDateTime() : n, i = (e) => {
11
12
  let t = [
12
13
  "th",
@@ -29,7 +30,7 @@ var e = class {
29
30
  }, l = (e) => {
30
31
  let t = e.month === 1 && e.day < 4 ? -1 : +(e.month === 12 && e.day > 28);
31
32
  return e.year + t;
32
- }, u = e.replace(/Q|Do|w|W|gggg|GGGG|k{1,2}|X|x|zzz?/g, (e) => {
33
+ }, u = e.replace(/Q|Do|w|W|gggg|GGGG|k{1,2}|X|x|zzz|z/g, (e) => {
33
34
  let t = "";
34
35
  switch (e) {
35
36
  case "Q":
@@ -63,10 +64,10 @@ var e = class {
63
64
  t = String(this.valueOf());
64
65
  break;
65
66
  case "z":
66
- t = `${this.getTimezoneOffset()}`;
67
+ t = this.getOffset();
67
68
  break;
68
69
  case "zzz":
69
- t = `${this.getTimezoneOffsetLong()}`;
70
+ t = this.getTimeZoneId() ?? "";
70
71
  break;
71
72
  default: return e;
72
73
  }
@@ -75,6 +76,10 @@ var e = class {
75
76
  return t.call(this, u);
76
77
  };
77
78
  }
79
+ uninstall(e) {
80
+ let t = this.originalFormats.get(e);
81
+ t && (e.prototype.format = t, this.originalFormats.delete(e));
82
+ }
78
83
  }, t = new e();
79
84
  //#endregion
80
85
  export { e as AdvancedFormatPlugin, t as default };
@@ -99,6 +99,12 @@ export declare class DurationPlugin implements ITimeGuardPlugin {
99
99
  * Install plugin into TimeGuard
100
100
  */
101
101
  install(TimeGuardClass: typeof TimeGuard): void;
102
+ /**
103
+ * Reverse install() — none of these (instance `.duration()`, static
104
+ * `Duration`/`duration`) pre-exist on TimeGuard, so undoing this is
105
+ * just deleting them.
106
+ */
107
+ uninstall(TimeGuardClass: typeof TimeGuard): void;
102
108
  }
103
109
  /**
104
110
  * Create and export default instance
@@ -1 +1 @@
1
- Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});var e=class e{years=0;months=0;weeks=0;days=0;hours=0;minutes=0;seconds=0;milliseconds=0;constructor(e){this.years=e.years||0,this.months=e.months||0,this.weeks=e.weeks||0,this.days=e.days||0,this.hours=e.hours||0,this.minutes=e.minutes||0,this.seconds=e.seconds||0,this.milliseconds=e.milliseconds||0}static fromISO(t){let n=t.match(/^(-)?P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:([\d.]+)S)?)?$/);if(!n)throw Error(`Invalid ISO 8601 duration: ${t}`);let[,r,i,a,,o,s,c,l]=n,u=r?-1:1;return new e({years:parseInt(i||`0`,10)*u,months:parseInt(a||`0`,10)*u,days:parseInt(o||`0`,10)*u,hours:parseInt(s||`0`,10)*u,minutes:parseInt(c||`0`,10)*u,seconds:parseFloat(l||`0`)*u})}static between(t,n){let r=t.toTemporal(),i=n.toTemporal().since(r);return new e({years:i.years||0,months:i.months||0,weeks:0,days:i.days||0,hours:i.hours||0,minutes:i.minutes||0,seconds:i.seconds||0,milliseconds:i.milliseconds||0})}static fromMilliseconds(t){let n=t<0,r=Math.abs(t),i=Math.floor(r/(1e3*60*60*24*365)),a=Math.floor(r%(1e3*60*60*24*365)/(1e3*60*60*24*30)),o=Math.floor(r%(1e3*60*60*24*30)/(1e3*60*60*24)),s=Math.floor(r%(1e3*60*60*24)/(1e3*60*60)),c=Math.floor(r%(1e3*60*60)/(1e3*60)),l=Math.floor(r%(1e3*60)/1e3),u=Math.floor(r%1e3),d=n?-1:1;return new e({years:i*d,months:a*d,days:o*d,hours:s*d,minutes:c*d,seconds:l*d,milliseconds:u*d})}as(e){return this.asMilliseconds()/{milliseconds:1,seconds:1e3,minutes:1e3*60,hours:1e3*60*60,days:1e3*60*60*24,weeks:1e3*60*60*24*7,months:1e3*60*60*24*30,years:1e3*60*60*24*365}[e]}asMilliseconds(){return this.years*1e3*60*60*24*365+this.months*1e3*60*60*24*30+this.weeks*1e3*60*60*24*7+this.days*1e3*60*60*24+this.hours*1e3*60*60+this.minutes*1e3*60+this.seconds*1e3+this.milliseconds}asSeconds(){return this.asMilliseconds()/1e3}asMinutes(){return this.asSeconds()/60}asHours(){return this.asMinutes()/60}asDays(){return this.asHours()/24}asWeeks(){return this.asDays()/7}asMonths(){return this.asDays()/30}asYears(){return this.asDays()/365}toObject(){return{years:this.years,months:this.months,weeks:this.weeks,days:this.days,hours:this.hours,minutes:this.minutes,seconds:this.seconds,milliseconds:this.milliseconds}}toISO(){let e=``;this.years&&(e+=`${this.years}Y`),this.months&&(e+=`${this.months}M`),(this.weeks||this.days)&&(e+=`${this.weeks*7+this.days}D`);let t=``;return this.hours&&(t+=`${this.hours}H`),this.minutes&&(t+=`${this.minutes}M`),(this.seconds||this.milliseconds)&&(t+=`${this.seconds+this.milliseconds/1e3}S`),`${this.isNegative()?`-`:``}P${e}${t?`T${t}`:``}`}humanize(){let e=[];if(this.years&&e.push(`${Math.abs(this.years)} year${Math.abs(this.years)===1?``:`s`}`),this.months&&e.push(`${Math.abs(this.months)} month${Math.abs(this.months)===1?``:`s`}`),this.weeks&&e.push(`${Math.abs(this.weeks)} week${Math.abs(this.weeks)===1?``:`s`}`),this.days&&e.push(`${Math.abs(this.days)} day${Math.abs(this.days)===1?``:`s`}`),this.hours&&e.push(`${Math.abs(this.hours)} hour${Math.abs(this.hours)===1?``:`s`}`),this.minutes&&e.push(`${Math.abs(this.minutes)} minute${Math.abs(this.minutes)===1?``:`s`}`),this.seconds&&e.push(`${Math.abs(this.seconds)} second${Math.abs(this.seconds)===1?``:`s`}`),this.milliseconds&&e.push(`${Math.abs(this.milliseconds)} ms`),e.length===0)return`0 seconds`;let t=e.join(`, `);return this.isNegative()?`-${t}`:t}isNegative(){return this.years<0||this.months<0||this.weeks<0||this.days<0||this.hours<0||this.minutes<0||this.seconds<0||this.milliseconds<0}abs(){return new e({years:Math.abs(this.years),months:Math.abs(this.months),weeks:Math.abs(this.weeks),days:Math.abs(this.days),hours:Math.abs(this.hours),minutes:Math.abs(this.minutes),seconds:Math.abs(this.seconds),milliseconds:Math.abs(this.milliseconds)})}toString(){return this.toISO()}},t=class{name=`duration`;version=`1.0.0`;install(t){t.prototype.duration=function(t){return e.between(this,t)},t.Duration=e,t.duration={fromISO:t=>e.fromISO(t),between:(t,n)=>e.between(t,n),fromMilliseconds:t=>e.fromMilliseconds(t)}}},n=new t;exports.Duration=e,exports.DurationPlugin=t,exports.default=n,exports.durationPlugin=n;
1
+ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});var e=class e{years=0;months=0;weeks=0;days=0;hours=0;minutes=0;seconds=0;milliseconds=0;constructor(e){this.years=e.years||0,this.months=e.months||0,this.weeks=e.weeks||0,this.days=e.days||0,this.hours=e.hours||0,this.minutes=e.minutes||0,this.seconds=e.seconds||0,this.milliseconds=e.milliseconds||0}static fromISO(t){let n=t.match(/^(-)?P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:([\d.]+)S)?)?$/);if(!n)throw Error(`Invalid ISO 8601 duration: ${t}`);let[,r,i,a,o,s,c,l,u]=n,d=r?-1:1;return new e({years:parseInt(i||`0`,10)*d,months:parseInt(a||`0`,10)*d,weeks:parseInt(o||`0`,10)*d,days:parseInt(s||`0`,10)*d,hours:parseInt(c||`0`,10)*d,minutes:parseInt(l||`0`,10)*d,seconds:parseFloat(u||`0`)*d})}static between(t,n){let r=t.toTemporal(),i=n.toTemporal().since(r);return new e({years:i.years||0,months:i.months||0,weeks:0,days:i.days||0,hours:i.hours||0,minutes:i.minutes||0,seconds:i.seconds||0,milliseconds:i.milliseconds||0})}static fromMilliseconds(t){let n=t<0,r=Math.abs(t),i=Math.floor(r/(1e3*60*60*24*365)),a=Math.floor(r%(1e3*60*60*24*365)/(1e3*60*60*24*30)),o=Math.floor(r%(1e3*60*60*24*30)/(1e3*60*60*24)),s=Math.floor(r%(1e3*60*60*24)/(1e3*60*60)),c=Math.floor(r%(1e3*60*60)/(1e3*60)),l=Math.floor(r%(1e3*60)/1e3),u=Math.floor(r%1e3),d=n?-1:1;return new e({years:i*d,months:a*d,days:o*d,hours:s*d,minutes:c*d,seconds:l*d,milliseconds:u*d})}as(e){return this.asMilliseconds()/{milliseconds:1,seconds:1e3,minutes:1e3*60,hours:1e3*60*60,days:1e3*60*60*24,weeks:1e3*60*60*24*7,months:1e3*60*60*24*30,years:1e3*60*60*24*365}[e]}asMilliseconds(){return this.years*1e3*60*60*24*365+this.months*1e3*60*60*24*30+this.weeks*1e3*60*60*24*7+this.days*1e3*60*60*24+this.hours*1e3*60*60+this.minutes*1e3*60+this.seconds*1e3+this.milliseconds}asSeconds(){return this.asMilliseconds()/1e3}asMinutes(){return this.asSeconds()/60}asHours(){return this.asMinutes()/60}asDays(){return this.asHours()/24}asWeeks(){return this.asDays()/7}asMonths(){return this.asDays()/30}asYears(){return this.asDays()/365}toObject(){return{years:this.years,months:this.months,weeks:this.weeks,days:this.days,hours:this.hours,minutes:this.minutes,seconds:this.seconds,milliseconds:this.milliseconds}}toISO(){let e=``;this.years&&(e+=`${this.years}Y`),this.months&&(e+=`${this.months}M`),(this.weeks||this.days)&&(e+=`${this.weeks*7+this.days}D`);let t=``;return this.hours&&(t+=`${this.hours}H`),this.minutes&&(t+=`${this.minutes}M`),(this.seconds||this.milliseconds)&&(t+=`${this.seconds+this.milliseconds/1e3}S`),`${this.isNegative()?`-`:``}P${e}${t?`T${t}`:``}`}humanize(){let e=[];if(this.years&&e.push(`${Math.abs(this.years)} year${Math.abs(this.years)===1?``:`s`}`),this.months&&e.push(`${Math.abs(this.months)} month${Math.abs(this.months)===1?``:`s`}`),this.weeks&&e.push(`${Math.abs(this.weeks)} week${Math.abs(this.weeks)===1?``:`s`}`),this.days&&e.push(`${Math.abs(this.days)} day${Math.abs(this.days)===1?``:`s`}`),this.hours&&e.push(`${Math.abs(this.hours)} hour${Math.abs(this.hours)===1?``:`s`}`),this.minutes&&e.push(`${Math.abs(this.minutes)} minute${Math.abs(this.minutes)===1?``:`s`}`),this.seconds&&e.push(`${Math.abs(this.seconds)} second${Math.abs(this.seconds)===1?``:`s`}`),this.milliseconds&&e.push(`${Math.abs(this.milliseconds)} ms`),e.length===0)return`0 seconds`;let t=e.join(`, `);return this.isNegative()?`-${t}`:t}isNegative(){return this.years<0||this.months<0||this.weeks<0||this.days<0||this.hours<0||this.minutes<0||this.seconds<0||this.milliseconds<0}abs(){return new e({years:Math.abs(this.years),months:Math.abs(this.months),weeks:Math.abs(this.weeks),days:Math.abs(this.days),hours:Math.abs(this.hours),minutes:Math.abs(this.minutes),seconds:Math.abs(this.seconds),milliseconds:Math.abs(this.milliseconds)})}toString(){return this.toISO()}},t=class{name=`duration`;version=`1.0.0`;install(t){t.prototype.duration=function(t){return e.between(this,t)},t.Duration=e,t.duration={fromISO:t=>e.fromISO(t),between:(t,n)=>e.between(t,n),fromMilliseconds:t=>e.fromMilliseconds(t)}}uninstall(e){delete e.prototype.duration,delete e.Duration,delete e.duration}},n=new t;exports.Duration=e,exports.DurationPlugin=t,exports.default=n,exports.durationPlugin=n;
@@ -1,4 +1,4 @@
1
- /*! time-guard v2.8.0 | (c) 2026 Berea-Soft | MIT License | https://github.com/Berea-Soft/time-guard */
1
+ /*! time-guard v2.9.0 | (c) 2026 Berea-Soft | MIT License | https://github.com/Berea-Soft/time-guard */
2
2
  //#region src/plugins/duration/index.ts
3
3
  var e = class e {
4
4
  years = 0;
@@ -15,14 +15,15 @@ var e = class e {
15
15
  static fromISO(t) {
16
16
  let n = t.match(/^(-)?P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:([\d.]+)S)?)?$/);
17
17
  if (!n) throw Error(`Invalid ISO 8601 duration: ${t}`);
18
- let [, r, i, a, , o, s, c, l] = n, u = r ? -1 : 1;
18
+ let [, r, i, a, o, s, c, l, u] = n, d = r ? -1 : 1;
19
19
  return new e({
20
- years: parseInt(i || "0", 10) * u,
21
- months: parseInt(a || "0", 10) * u,
22
- days: parseInt(o || "0", 10) * u,
23
- hours: parseInt(s || "0", 10) * u,
24
- minutes: parseInt(c || "0", 10) * u,
25
- seconds: parseFloat(l || "0") * u
20
+ years: parseInt(i || "0", 10) * d,
21
+ months: parseInt(a || "0", 10) * d,
22
+ weeks: parseInt(o || "0", 10) * d,
23
+ days: parseInt(s || "0", 10) * d,
24
+ hours: parseInt(c || "0", 10) * d,
25
+ minutes: parseInt(l || "0", 10) * d,
26
+ seconds: parseFloat(u || "0") * d
26
27
  });
27
28
  }
28
29
  static between(t, n) {
@@ -140,6 +141,9 @@ var e = class e {
140
141
  fromMilliseconds: (t) => e.fromMilliseconds(t)
141
142
  };
142
143
  }
144
+ uninstall(e) {
145
+ delete e.prototype.duration, delete e.Duration, delete e.duration;
146
+ }
143
147
  }, n = new t();
144
148
  //#endregion
145
149
  export { e as Duration, t as DurationPlugin, n as default, n as durationPlugin };
@@ -43,12 +43,16 @@ export declare class PluginManager {
43
43
  */
44
44
  static listPlugins(): string[];
45
45
  /**
46
- * Unregister a plugin
46
+ * Unregister a plugin — calls its uninstall() hook (if implemented) to
47
+ * reverse whatever install() did, so re-registering the same plugin
48
+ * later starts from a clean prototype instead of stacking a new patch
49
+ * on top of the old one.
47
50
  * @param name - Plugin name
48
51
  */
49
52
  static unuse(name: string): boolean;
50
53
  /**
51
- * Clear all plugins
54
+ * Clear all plugins — calls each one's uninstall() hook (if implemented)
55
+ * before forgetting it, for the same reason as unuse().
52
56
  */
53
57
  static clear(): void;
54
58
  /**
@@ -11,6 +11,12 @@ export declare class RelativeTimePlugin implements ITimeGuardPlugin {
11
11
  * Install plugin into TimeGuard
12
12
  */
13
13
  install(TimeGuardClass: typeof TimeGuard): void;
14
+ /**
15
+ * Reverse install() — none of fromNow/toNow/humanize pre-exist on
16
+ * TimeGuard, so undoing this is just deleting them, not restoring a
17
+ * prior value.
18
+ */
19
+ uninstall(TimeGuardClass: typeof TimeGuard): void;
14
20
  /**
15
21
  * Format relative time
16
22
  */
@@ -1 +1 @@
1
- Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});var e=[{l:`s`,r:44,d:`second`},{l:`m`,r:89},{l:`mm`,r:44,d:`minute`},{l:`h`,r:89},{l:`hh`,r:21,d:`hour`},{l:`d`,r:35},{l:`dd`,r:25,d:`day`},{l:`M`,r:45},{l:`MM`,r:10,d:`month`},{l:`y`,r:17},{l:`yy`,d:`year`}],t={future:`in %s`,past:`%s ago`,s:`a few seconds`,m:`a minute`,mm:`%d minutes`,h:`an hour`,hh:`%d hours`,d:`a day`,dd:`%d days`,M:`a month`,MM:`%d months`,y:`a year`,yy:`%d years`},n=class{name=`relative-time`;version=`1.0.0`;config;formats;constructor(n){this.config={thresholds:n?.thresholds||e,rounding:n?.rounding||Math.round},this.formats=t}install(e){let t=this;e.prototype.fromNow=function(e){return t.formatRelativeTime(this,!1,e)},e.prototype.toNow=function(e){return t.formatRelativeTime(this,!0,e)},e.prototype.humanize=function(e,n){return e?t.formatRelativeTime(this,e.isAfter(this),n):t.formatRelativeTime(this,!1,n)}}formatRelativeTime(e,t,n){let r=e.constructor.now().diff(e,`millisecond`),i=Math.abs(r),a=t??!(r>0),o=this.getRelativeTimeString(i);return n?o:(a?this.formats.future:this.formats.past).replace(`%s`,o)}getRelativeTimeString(t){let n=this.config.thresholds||e,r=this.config.rounding||Math.round,i=`second`;for(let e=0;e<n.length;e++){let a=n[e];i=a.d||i;let o=t/this.getUnitMilliseconds(i);if(e===n.length-1||a.r===void 0||o<=a.r){let e=r(o),t=a.l,n=this.formats[t]||t;return typeof n==`string`&&n.includes(`%d`)?n.replace(`%d`,String(e)):n}}return`${r(t/1e3)} seconds`}getUnitMilliseconds(e){return{second:1e3,minute:1e3*60,hour:1e3*60*60,day:1e3*60*60*24,month:1e3*60*60*24*30,year:1e3*60*60*24*365}[e]||1}setFormats(e){Object.assign(this.formats,e)}getFormats(){return{...this.formats}}},r=new n;exports.RelativeTimePlugin=n,exports.default=r;
1
+ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});var e=[{l:`s`,r:44,d:`second`},{l:`m`,r:89},{l:`mm`,r:44,d:`minute`},{l:`h`,r:89},{l:`hh`,r:21,d:`hour`},{l:`d`,r:35},{l:`dd`,r:25,d:`day`},{l:`M`,r:45},{l:`MM`,r:10,d:`month`},{l:`y`,r:17},{l:`yy`,d:`year`}],t={future:`in %s`,past:`%s ago`,s:`a few seconds`,m:`a minute`,mm:`%d minutes`,h:`an hour`,hh:`%d hours`,d:`a day`,dd:`%d days`,M:`a month`,MM:`%d months`,y:`a year`,yy:`%d years`},n=class{name=`relative-time`;version=`1.0.0`;config;formats;constructor(n){this.config={thresholds:n?.thresholds||e,rounding:n?.rounding||Math.round},this.formats=t}install(e){let t=this;e.prototype.fromNow=function(e){return t.formatRelativeTime(this,!1,e)},e.prototype.toNow=function(e){return t.formatRelativeTime(this,!0,e)},e.prototype.humanize=function(e,n){return e?t.formatRelativeTime(this,e.isAfter(this),n):t.formatRelativeTime(this,!1,n)}}uninstall(e){delete e.prototype.fromNow,delete e.prototype.toNow,delete e.prototype.humanize}formatRelativeTime(e,t,n){let r=e.constructor.now().diff(e,`millisecond`),i=Math.abs(r),a=t??!(r>0),o=this.getRelativeTimeString(i);return n?o:(a?this.formats.future:this.formats.past).replace(`%s`,o)}getRelativeTimeString(t){let n=this.config.thresholds||e,r=this.config.rounding||Math.round,i=`second`;for(let e=0;e<n.length;e++){let a=n[e];i=a.d||i;let o=t/this.getUnitMilliseconds(i);if(e===n.length-1||a.r===void 0||o<=a.r){let e=r(o),t=a.l,n=this.formats[t]||t;return typeof n==`string`&&n.includes(`%d`)?n.replace(`%d`,String(e)):n}}return`${r(t/1e3)} seconds`}getUnitMilliseconds(e){return{second:1e3,minute:1e3*60,hour:1e3*60*60,day:1e3*60*60*24,month:1e3*60*60*24*30,year:1e3*60*60*24*365}[e]||1}setFormats(e){Object.assign(this.formats,e)}getFormats(){return{...this.formats}}},r=new n;exports.RelativeTimePlugin=n,exports.default=r;
@@ -1,4 +1,4 @@
1
- /*! time-guard v2.8.0 | (c) 2026 Berea-Soft | MIT License | https://github.com/Berea-Soft/time-guard */
1
+ /*! time-guard v2.9.0 | (c) 2026 Berea-Soft | MIT License | https://github.com/Berea-Soft/time-guard */
2
2
  //#region src/plugins/relative-time/index.ts
3
3
  var e = [
4
4
  {
@@ -85,6 +85,9 @@ var e = [
85
85
  return e ? t.formatRelativeTime(this, e.isAfter(this), n) : t.formatRelativeTime(this, !1, n);
86
86
  };
87
87
  }
88
+ uninstall(e) {
89
+ delete e.prototype.fromNow, delete e.prototype.toNow, delete e.prototype.humanize;
90
+ }
88
91
  formatRelativeTime(e, t, n) {
89
92
  let r = e.constructor.now().diff(e, "millisecond"), i = Math.abs(r), a = t ?? !(r > 0), o = this.getRelativeTimeString(i);
90
93
  return n ? o : (a ? this.formats.future : this.formats.past).replace("%s", o);
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../core-TqmHKXY1.cjs");let t=require("@builder.io/qwik");function n(n,r){let i=(0,t.useSignal)(e.i.from(n,r));return(0,t.useTask$)(({track:t})=>{t(()=>n),i.value=e.i.from(n,r)}),i}function r(n){let r=n?.interval??1e3,i=n?.config,a=(0,t.useSignal)(e.i.now(i));return(0,t.useVisibleTask$)(({cleanup:t})=>{let n=setInterval(()=>{a.value=e.i.now(i)},r);t(()=>clearInterval(n))}),a}function i(n,r){let i=r?.interval??6e4,a=r?.locale,o=r?.numeric,s=()=>e.o(n,{locale:a,numeric:o}),c=(0,t.useSignal)(s());return(0,t.useVisibleTask$)(({cleanup:e})=>{let t=setInterval(()=>{c.value=s()},i);e(()=>clearInterval(t))}),c}function a(n,r,i){let a=(0,t.useSignal)(e.s(n,r,i));return(0,t.useTask$)(({track:t})=>{t(()=>n),t(()=>r),a.value=e.s(n,r,i)}),a}exports.useCurrentTime=r,exports.useRelativeTime=i,exports.useTimeGuard=n,exports.useTimeRange=a;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../core-BDQnStek.cjs");let t=require("@builder.io/qwik");function n(n,r){let i=(0,t.useSignal)(e.i.from((0,t.isSignal)(n)?n.value:n,r));return(0,t.useTask$)(({track:a})=>{if((0,t.isSignal)(n)){let t=n;i.value=e.i.from(a(()=>t.value),r)}else i.value=e.i.from(n,r)}),i}function r(n){let r=n?.interval??1e3,i=n?.config,a=(0,t.useSignal)(e.i.now(i));return(0,t.useVisibleTask$)(({cleanup:t})=>{let n=setInterval(()=>{a.value=e.i.now(i)},r);t(()=>clearInterval(n))}),a}function i(n,r){let i=r?.interval??6e4,a=r?.locale,o=r?.numeric,s=()=>e.o(n,{locale:a,numeric:o}),c=(0,t.useSignal)(s());return(0,t.useVisibleTask$)(({cleanup:e})=>{let t=setInterval(()=>{c.value=s()},i);e(()=>clearInterval(t))}),c}function a(n,r,i){let a=(0,t.useSignal)(e.s(n,r,i));return(0,t.useTask$)(({track:t})=>{t(()=>n),t(()=>r),a.value=e.s(n,r,i)}),a}exports.useCurrentTime=r,exports.useRelativeTime=i,exports.useTimeGuard=n,exports.useTimeRange=a;
@@ -1,39 +1,42 @@
1
- /*! time-guard v2.8.0 | (c) 2026 Berea-Soft | MIT License | https://github.com/Berea-Soft/time-guard */
2
- import { i as e, o as t, s as n } from "../core-Dxn1aRFk.js";
3
- import { useSignal as r, useTask$ as i, useVisibleTask$ as a } from "@builder.io/qwik";
1
+ /*! time-guard v2.9.0 | (c) 2026 Berea-Soft | MIT License | https://github.com/Berea-Soft/time-guard */
2
+ import { i as e, o as t, s as n } from "../core-GHK7isoa.js";
3
+ import { isSignal as r, useSignal as i, useTask$ as a, useVisibleTask$ as o } from "@builder.io/qwik";
4
4
  //#region src/qwik.ts
5
- function o(t, n) {
6
- let a = r(e.from(t, n));
7
- return i(({ track: r }) => {
8
- r(() => t), a.value = e.from(t, n);
9
- }), a;
5
+ function s(t, n) {
6
+ let o = i(e.from(r(t) ? t.value : t, n));
7
+ return a(({ track: i }) => {
8
+ if (r(t)) {
9
+ let r = t;
10
+ o.value = e.from(i(() => r.value), n);
11
+ } else o.value = e.from(t, n);
12
+ }), o;
10
13
  }
11
- function s(t) {
12
- let n = t?.interval ?? 1e3, i = t?.config, o = r(e.now(i));
13
- return a(({ cleanup: t }) => {
14
- let r = setInterval(() => {
15
- o.value = e.now(i);
14
+ function c(t) {
15
+ let n = t?.interval ?? 1e3, r = t?.config, a = i(e.now(r));
16
+ return o(({ cleanup: t }) => {
17
+ let i = setInterval(() => {
18
+ a.value = e.now(r);
16
19
  }, n);
17
- t(() => clearInterval(r));
18
- }), o;
20
+ t(() => clearInterval(i));
21
+ }), a;
19
22
  }
20
- function c(e, n) {
21
- let i = n?.interval ?? 6e4, o = n?.locale, s = n?.numeric, c = () => t(e, {
22
- locale: o,
23
+ function l(e, n) {
24
+ let r = n?.interval ?? 6e4, a = n?.locale, s = n?.numeric, c = () => t(e, {
25
+ locale: a,
23
26
  numeric: s
24
- }), l = r(c());
25
- return a(({ cleanup: e }) => {
27
+ }), l = i(c());
28
+ return o(({ cleanup: e }) => {
26
29
  let t = setInterval(() => {
27
30
  l.value = c();
28
- }, i);
31
+ }, r);
29
32
  e(() => clearInterval(t));
30
33
  }), l;
31
34
  }
32
- function l(e, t, a) {
33
- let o = r(n(e, t, a));
34
- return i(({ track: r }) => {
35
- r(() => e), r(() => t), o.value = n(e, t, a);
35
+ function u(e, t, r) {
36
+ let o = i(n(e, t, r));
37
+ return a(({ track: i }) => {
38
+ i(() => e), i(() => t), o.value = n(e, t, r);
36
39
  }), o;
37
40
  }
38
41
  //#endregion
39
- export { s as useCurrentTime, c as useRelativeTime, o as useTimeGuard, l as useTimeRange };
42
+ export { c as useCurrentTime, l as useRelativeTime, s as useTimeGuard, u as useTimeRange };
package/dist/qwik.d.ts CHANGED
@@ -2,7 +2,11 @@ import { Signal } from '@builder.io/qwik';
2
2
  import { TimeGuard, ITimeGuardConfig, TimeRange } from './core';
3
3
  /**
4
4
  * Creates a Qwik Signal of a TimeGuard instance.
5
- * Uses `useTask$` to reactively update when input changes.
5
+ * Uses `useTask$` to reactively update when input changes — pass a Signal
6
+ * for `input` to make this actually track it via `track()`; a plain value
7
+ * is used once and won't update on its own (`track()` only registers a
8
+ * dependency when it reads a Signal's `.value`, not a closed-over plain
9
+ * variable).
6
10
  * Must be called inside `component$`.
7
11
  */
8
12
  export declare function useTimeGuard(input?: unknown, config?: ITimeGuardConfig): Signal<TimeGuard>;
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../chunk-C6qsp3rV.cjs"),t=require("../core-TqmHKXY1.cjs");let n=require("react");n=e.n(n,1);var r=(0,n.createContext)(void 0);function i({children:e,config:t}){return n.default.createElement(r.Provider,{value:t},e)}function a(){return(0,n.useContext)(r)}function o(e,r){let i=a(),o=r??i,[s,c]=(0,n.useState)(()=>t.i.from(e,o));return(0,n.useEffect)(()=>{c(t.i.from(e,o))},[e,o?.locale,o?.timezone,o?.strict]),s}function s(e){let r=a(),i=e?.config??r,o=e?.interval??1e3,[s,c]=(0,n.useState)(()=>t.i.now(i));return(0,n.useEffect)(()=>{let e=setInterval(()=>{c(t.i.now(i))},o);return()=>clearInterval(e)},[o,i?.locale,i?.timezone,i?.strict]),s}function c(e,r){let i=a(),o=r?.interval??6e4,s=r?.locale??i?.locale,c=r?.numeric,[l,u]=(0,n.useState)(``);return(0,n.useEffect)(()=>{let n=()=>{u(t.o(e,{locale:s,numeric:c}))};n();let r=setInterval(n,o);return()=>clearInterval(r)},[e,o,s,c]),l}function l(e,r,i){let o=a(),s=i??o,[c,l]=(0,n.useState)(()=>t.s(e,r,s));return(0,n.useEffect)(()=>{l(t.s(e,r,s))},[e,r,s?.locale,s?.timezone,s?.strict]),c}exports.TimeGuardContext=r,exports.TimeGuardProvider=i,exports.useCurrentTime=s,exports.useRelativeTime=c,exports.useTimeGuard=o,exports.useTimeGuardConfig=a,exports.useTimeRange=l;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../chunk-C6qsp3rV.cjs"),t=require("../core-BDQnStek.cjs");let n=require("react");n=e.n(n,1);var r=(0,n.createContext)(void 0);function i({children:e,config:t}){return n.default.createElement(r.Provider,{value:t},e)}function a(){return(0,n.useContext)(r)}function o(e,r){let i=a(),o=r??i,[s,c]=(0,n.useState)(()=>t.i.from(e,o));return(0,n.useEffect)(()=>{c(t.i.from(e,o))},[e,o?.locale,o?.timezone,o?.strict]),s}function s(e){let r=a(),i=e?.config??r,o=e?.interval??1e3,[s,c]=(0,n.useState)(()=>t.i.now(i));return(0,n.useEffect)(()=>{let e=setInterval(()=>{c(t.i.now(i))},o);return()=>clearInterval(e)},[o,i?.locale,i?.timezone,i?.strict]),s}function c(e,r){let i=a(),o=r?.interval??6e4,s=r?.locale??i?.locale,c=r?.numeric,[l,u]=(0,n.useState)(``);return(0,n.useEffect)(()=>{let n=()=>{u(t.o(e,{locale:s,numeric:c}))};n();let r=setInterval(n,o);return()=>clearInterval(r)},[e,o,s,c]),l}function l(e,r,i){let o=a(),s=i??o,[c,l]=(0,n.useState)(()=>t.s(e,r,s));return(0,n.useEffect)(()=>{l(t.s(e,r,s))},[e,r,s?.locale,s?.timezone,s?.strict]),c}exports.TimeGuardContext=r,exports.TimeGuardProvider=i,exports.useCurrentTime=s,exports.useRelativeTime=c,exports.useTimeGuard=o,exports.useTimeGuardConfig=a,exports.useTimeRange=l;
@@ -1,5 +1,5 @@
1
- /*! time-guard v2.8.0 | (c) 2026 Berea-Soft | MIT License | https://github.com/Berea-Soft/time-guard */
2
- import { i as e, o as t, s as n } from "../core-Dxn1aRFk.js";
1
+ /*! time-guard v2.9.0 | (c) 2026 Berea-Soft | MIT License | https://github.com/Berea-Soft/time-guard */
2
+ import { i as e, o as t, s as n } from "../core-GHK7isoa.js";
3
3
  import r, { createContext as i, useContext as a, useEffect as o, useState as s } from "react";
4
4
  //#region src/react.ts
5
5
  var c = i(void 0);
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../core-TqmHKXY1.cjs");let t=require("solid-js");var n=Symbol(`TimeGuardConfig`);function r(n,r){let[i,a]=(0,t.createSignal)(e.i.from(n,r));return(0,t.createEffect)(()=>{let t=n;a(()=>e.i.from(t,r))}),i}function i(n){let r=n?.interval??1e3,i=n?.config,[a,o]=(0,t.createSignal)(e.i.now(i)),s=setInterval(()=>{o(e.i.now(i))},r);return(0,t.onCleanup)(()=>{clearInterval(s)}),a}function a(n,r){let i=r?.interval??6e4,a=r?.locale,o=r?.numeric,s=()=>e.o(n,{locale:a,numeric:o}),[c,l]=(0,t.createSignal)(s()),u=setInterval(()=>{l(s())},i);return(0,t.onCleanup)(()=>{clearInterval(u)}),c}function o(n,r,i){let[a,o]=(0,t.createSignal)(e.s(n,r,i));return(0,t.createEffect)(()=>{let t=n,a=r;o(()=>e.s(t,a,i))}),a}exports.TimeGuardConfigContext=n,exports.useCurrentTime=i,exports.useRelativeTime=a,exports.useTimeGuard=r,exports.useTimeRange=o;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../core-BDQnStek.cjs");let t=require("solid-js");var n=Symbol(`TimeGuardConfig`);function r(e){return typeof e==`function`?e():e}function i(n,i){let[a,o]=(0,t.createSignal)(e.i.from(r(n),i));return(0,t.createEffect)(()=>{o(()=>e.i.from(r(n),i))}),a}function a(n){let r=n?.interval??1e3,i=n?.config,[a,o]=(0,t.createSignal)(e.i.now(i)),s=setInterval(()=>{o(e.i.now(i))},r);return(0,t.onCleanup)(()=>{clearInterval(s)}),a}function o(n,r){let i=r?.interval??6e4,a=r?.locale,o=r?.numeric,s=()=>e.o(n,{locale:a,numeric:o}),[c,l]=(0,t.createSignal)(s()),u=setInterval(()=>{l(s())},i);return(0,t.onCleanup)(()=>{clearInterval(u)}),c}function s(n,r,i){let[a,o]=(0,t.createSignal)(e.s(n,r,i));return(0,t.createEffect)(()=>{let t=n,a=r;o(()=>e.s(t,a,i))}),a}exports.TimeGuardConfigContext=n,exports.useCurrentTime=a,exports.useRelativeTime=o,exports.useTimeGuard=i,exports.useTimeRange=s;