chronos-date 1.0.2 → 1.1.1

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 (117) hide show
  1. package/dist/basic-DqKyujoj.mjs +382 -0
  2. package/dist/basic-DsQqC5nZ.cjs +466 -0
  3. package/dist/constants.cjs +43 -1
  4. package/dist/constants.d.cts +17 -1
  5. package/dist/constants.d.mts +17 -1
  6. package/dist/constants.mjs +21 -1
  7. package/dist/convert-DbgntRVW.cjs +49 -0
  8. package/dist/convert-mMaI4YP0.mjs +38 -0
  9. package/dist/greet-D07t2_e6.mjs +51 -0
  10. package/dist/greet-hjVsd2dt.cjs +56 -0
  11. package/dist/guards.cjs +140 -1
  12. package/dist/guards.d.cts +18 -2
  13. package/dist/guards.d.mts +18 -2
  14. package/dist/guards.mjs +131 -1
  15. package/dist/helpers-CQzi908i.cjs +278 -0
  16. package/dist/helpers-DEf4sevD.mjs +201 -0
  17. package/dist/index.cjs +1477 -1
  18. package/dist/index.d.cts +18 -2
  19. package/dist/index.d.mts +18 -2
  20. package/dist/index.mjs +1474 -1
  21. package/dist/non-primitives-D9zxCwX8.cjs +68 -0
  22. package/dist/non-primitives-DBtomDty.mjs +38 -0
  23. package/dist/plugins/banglaPlugin.cjs +137 -1
  24. package/dist/plugins/banglaPlugin.d.cts +19 -3
  25. package/dist/plugins/banglaPlugin.d.mts +19 -3
  26. package/dist/plugins/banglaPlugin.mjs +136 -1
  27. package/dist/plugins/businessPlugin.cjs +134 -1
  28. package/dist/plugins/businessPlugin.d.cts +17 -1
  29. package/dist/plugins/businessPlugin.d.mts +17 -1
  30. package/dist/plugins/businessPlugin.mjs +133 -1
  31. package/dist/plugins/dateRangePlugin.cjs +62 -1
  32. package/dist/plugins/dateRangePlugin.d.cts +19 -3
  33. package/dist/plugins/dateRangePlugin.d.mts +19 -3
  34. package/dist/plugins/dateRangePlugin.mjs +61 -1
  35. package/dist/plugins/dayPartPlugin.cjs +42 -1
  36. package/dist/plugins/dayPartPlugin.d.cts +17 -1
  37. package/dist/plugins/dayPartPlugin.d.mts +17 -1
  38. package/dist/plugins/dayPartPlugin.mjs +41 -1
  39. package/dist/plugins/durationPlugin.cjs +107 -1
  40. package/dist/plugins/durationPlugin.d.cts +17 -1
  41. package/dist/plugins/durationPlugin.d.mts +17 -1
  42. package/dist/plugins/durationPlugin.mjs +106 -1
  43. package/dist/plugins/fromNowPlugin.cjs +96 -1
  44. package/dist/plugins/fromNowPlugin.d.cts +17 -1
  45. package/dist/plugins/fromNowPlugin.d.mts +17 -1
  46. package/dist/plugins/fromNowPlugin.mjs +95 -1
  47. package/dist/plugins/greetingPlugin.cjs +35 -1
  48. package/dist/plugins/greetingPlugin.d.cts +17 -1
  49. package/dist/plugins/greetingPlugin.d.mts +17 -1
  50. package/dist/plugins/greetingPlugin.mjs +34 -1
  51. package/dist/plugins/palindromePlugin.cjs +38 -1
  52. package/dist/plugins/palindromePlugin.d.cts +17 -1
  53. package/dist/plugins/palindromePlugin.d.mts +17 -1
  54. package/dist/plugins/palindromePlugin.mjs +37 -1
  55. package/dist/plugins/relativeTimePlugin.cjs +90 -1
  56. package/dist/plugins/relativeTimePlugin.d.cts +17 -1
  57. package/dist/plugins/relativeTimePlugin.d.mts +17 -1
  58. package/dist/plugins/relativeTimePlugin.mjs +89 -1
  59. package/dist/plugins/roundPlugin.cjs +85 -1
  60. package/dist/plugins/roundPlugin.d.cts +17 -1
  61. package/dist/plugins/roundPlugin.d.mts +17 -1
  62. package/dist/plugins/roundPlugin.mjs +84 -1
  63. package/dist/plugins/seasonPlugin.cjs +47 -1
  64. package/dist/plugins/seasonPlugin.d.cts +17 -1
  65. package/dist/plugins/seasonPlugin.d.mts +17 -1
  66. package/dist/plugins/seasonPlugin.mjs +46 -1
  67. package/dist/plugins/timeZonePlugin.cjs +155 -1
  68. package/dist/plugins/timeZonePlugin.d.cts +17 -1
  69. package/dist/plugins/timeZonePlugin.d.mts +17 -1
  70. package/dist/plugins/timeZonePlugin.mjs +154 -1
  71. package/dist/plugins/zodiacPlugin.cjs +67 -1
  72. package/dist/plugins/zodiacPlugin.d.cts +17 -1
  73. package/dist/plugins/zodiacPlugin.d.mts +17 -1
  74. package/dist/plugins/zodiacPlugin.mjs +66 -1
  75. package/dist/primitives-CtuSNmV7.cjs +65 -0
  76. package/dist/primitives-dXzXlzJw.mjs +35 -0
  77. package/dist/seasons-B7kK88zq.cjs +434 -0
  78. package/dist/{seasons-CioTH5Dm.d.mts → seasons-B_kjFWIX.d.mts} +16 -0
  79. package/dist/{seasons-CsVeJ27s.d.cts → seasons-CpUn45n6.d.cts} +16 -0
  80. package/dist/seasons-Cq3ah3pV.mjs +368 -0
  81. package/dist/timezone-BNnHFgki.cjs +5625 -0
  82. package/dist/timezone-Db2CeL32.mjs +5589 -0
  83. package/dist/{types-B2fgrJ86.d.mts → types-Cb4gxrgJ.d.mts} +29 -15
  84. package/dist/{types-DPTQ_yLx.d.cts → types-CdmsXbU_.d.cts} +29 -15
  85. package/dist/types.cjs +16 -0
  86. package/dist/types.d.cts +18 -2
  87. package/dist/types.d.mts +18 -2
  88. package/dist/types.mjs +17 -1
  89. package/dist/utilities-BGX8dviZ.mjs +257 -0
  90. package/dist/utilities-BKtVo78T.mjs +59 -0
  91. package/dist/utilities-CpF3uys3.cjs +88 -0
  92. package/dist/utilities-D47SN9EZ.cjs +334 -0
  93. package/dist/utils.cjs +92 -1
  94. package/dist/utils.d.cts +20 -4
  95. package/dist/utils.d.mts +20 -4
  96. package/dist/utils.mjs +60 -1
  97. package/package.json +10 -4
  98. package/dist/basic-CKxaRSHQ.cjs +0 -1
  99. package/dist/basic-e46DaNAi.mjs +0 -1
  100. package/dist/convert-Bmp63ats.mjs +0 -1
  101. package/dist/convert-DrLrcgqz.cjs +0 -1
  102. package/dist/greet-BBsrvmkn.mjs +0 -1
  103. package/dist/greet-C-6mruI9.cjs +0 -1
  104. package/dist/helpers-DGzYnP81.cjs +0 -1
  105. package/dist/helpers-N1X_Rj_V.mjs +0 -1
  106. package/dist/non-primitives-B2EE6D6s.mjs +0 -1
  107. package/dist/non-primitives-Bu3a4WL4.cjs +0 -1
  108. package/dist/primitives-Cxss_JVF.mjs +0 -1
  109. package/dist/primitives-Db2FUp4e.cjs +0 -1
  110. package/dist/seasons-ChAIVphi.mjs +0 -1
  111. package/dist/seasons-oABOhHcX.cjs +0 -1
  112. package/dist/timezone-B10UItNO.mjs +0 -1
  113. package/dist/timezone-CWxbK_7I.cjs +0 -1
  114. package/dist/utilities-B8dOAQVD.cjs +0 -1
  115. package/dist/utilities-BJE06bms.mjs +0 -1
  116. package/dist/utilities-D2-p26DX.cjs +0 -1
  117. package/dist/utilities-DV_ohS37.mjs +0 -1
@@ -1 +1,90 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../basic-CKxaRSHQ.cjs`),t=t=>{let{toNewDate:n}=t[e.s];t.prototype.getRelativeYear=function(e){let t=this.toDate(),r=n(this,e),i=t.getFullYear()-r.getFullYear();return(r.getMonth()<t.getMonth()||r.getMonth()===t.getMonth()&&r.getDate()<t.getDate())&&i--,i},t.prototype.getRelativeMonth=function(e){let t=this.toDate(),r=n(this,e),i=(t.getFullYear()-r.getFullYear())*12+(t.getMonth()-r.getMonth());return r.getDate()<t.getDate()&&i--,i},t.prototype.getRelativeWeek=function(e){let t=this.getRelativeDay(e);return Math.floor(t/7)},t.prototype.getRelativeDay=function(e){let t=n(this,e);t.setHours(0,0,0,0);let r=new Date(this.toDate());r.setHours(0,0,0,0);let i=r.getTime()-t.getTime();return Math.floor(i/(1e3*60*60*24))},t.prototype.getRelativeHour=function(e){let t=this.getTimeStamp()-n(this,e).getTime();return Math.floor(t/(1e3*60*60))},t.prototype.getRelativeMinute=function(e){let t=this.getTimeStamp()-n(this,e).getTime();return Math.floor(t/(1e3*60))},t.prototype.getRelativeSecond=function(e){let t=this.getTimeStamp()-n(this,e).getTime();return Math.floor(t/1e3)},t.prototype.getRelativeMilliSecond=function(e){return this.getTimeStamp()-n(this,e).getTime()},t.prototype.compare=function(e=`minute`,t){switch(e){case`year`:return this.getRelativeYear(t);case`month`:return this.getRelativeMonth(t);case`day`:return this.getRelativeDay(t);case`week`:return this.getRelativeWeek(t);case`hour`:return this.getRelativeHour(t);case`minute`:return this.getRelativeMinute(t);case`second`:return this.getRelativeSecond(t);case`millisecond`:return this.getRelativeMilliSecond(t);default:throw RangeError(`Unsupported time unit: ${e}`)}},t.prototype.isToday=function(){return this.getRelativeDay()===0},t.prototype.isTomorrow=function(){return this.getRelativeDay()===1},t.prototype.isYesterday=function(){return this.getRelativeDay()===-1}};exports.relativeTimePlugin=t;
1
+ /**
2
+ * Copyright 2026 - present Nazmul Hassan
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
18
+ const require_basic = require('../basic-DsQqC5nZ.cjs');
19
+
20
+ //#region src/plugins/relativeTimePlugin.ts
21
+ /** * Plugin to inject `relative time` related methods */
22
+ const relativeTimePlugin = ($Chronos) => {
23
+ const { toNewDate } = $Chronos[require_basic.INTERNALS];
24
+ $Chronos.prototype.getRelativeYear = function(time) {
25
+ const $date = this.toDate();
26
+ const now = toNewDate(this, time);
27
+ let years = $date.getFullYear() - now.getFullYear();
28
+ if (now.getMonth() < $date.getMonth() || now.getMonth() === $date.getMonth() && now.getDate() < $date.getDate()) years--;
29
+ return years;
30
+ };
31
+ $Chronos.prototype.getRelativeMonth = function(time) {
32
+ const $date = this.toDate();
33
+ const now = toNewDate(this, time);
34
+ let months = ($date.getFullYear() - now.getFullYear()) * 12 + ($date.getMonth() - now.getMonth());
35
+ if (now.getDate() < $date.getDate()) months--;
36
+ return months;
37
+ };
38
+ $Chronos.prototype.getRelativeWeek = function(time) {
39
+ const relativeDays = this.getRelativeDay(time);
40
+ return Math.floor(relativeDays / 7);
41
+ };
42
+ $Chronos.prototype.getRelativeDay = function(time) {
43
+ const now = toNewDate(this, time);
44
+ now.setHours(0, 0, 0, 0);
45
+ const $date = new Date(this.toDate());
46
+ $date.setHours(0, 0, 0, 0);
47
+ const diffTime = $date.getTime() - now.getTime();
48
+ return Math.floor(diffTime / (1e3 * 60 * 60 * 24));
49
+ };
50
+ $Chronos.prototype.getRelativeHour = function(time) {
51
+ const diff = this.getTimeStamp() - toNewDate(this, time).getTime();
52
+ return Math.floor(diff / (1e3 * 60 * 60));
53
+ };
54
+ $Chronos.prototype.getRelativeMinute = function(time) {
55
+ const diff = this.getTimeStamp() - toNewDate(this, time).getTime();
56
+ return Math.floor(diff / (1e3 * 60));
57
+ };
58
+ $Chronos.prototype.getRelativeSecond = function(time) {
59
+ const diff = this.getTimeStamp() - toNewDate(this, time).getTime();
60
+ return Math.floor(diff / 1e3);
61
+ };
62
+ $Chronos.prototype.getRelativeMilliSecond = function(time) {
63
+ return this.getTimeStamp() - toNewDate(this, time).getTime();
64
+ };
65
+ $Chronos.prototype.compare = function(unit = "minute", time) {
66
+ switch (unit) {
67
+ case "year": return this.getRelativeYear(time);
68
+ case "month": return this.getRelativeMonth(time);
69
+ case "day": return this.getRelativeDay(time);
70
+ case "week": return this.getRelativeWeek(time);
71
+ case "hour": return this.getRelativeHour(time);
72
+ case "minute": return this.getRelativeMinute(time);
73
+ case "second": return this.getRelativeSecond(time);
74
+ case "millisecond": return this.getRelativeMilliSecond(time);
75
+ default: throw new RangeError(`Unsupported time unit: ${unit}`);
76
+ }
77
+ };
78
+ $Chronos.prototype.isToday = function() {
79
+ return this.getRelativeDay() === 0;
80
+ };
81
+ $Chronos.prototype.isTomorrow = function() {
82
+ return this.getRelativeDay() === 1;
83
+ };
84
+ $Chronos.prototype.isYesterday = function() {
85
+ return this.getRelativeDay() === -1;
86
+ };
87
+ };
88
+
89
+ //#endregion
90
+ exports.relativeTimePlugin = relativeTimePlugin;
@@ -1,4 +1,20 @@
1
- import { C as $Chronos, D as ChronosInput, Et as TimeUnit } from "../types-DPTQ_yLx.cjs";
1
+ /**
2
+ * Copyright 2026 - present Nazmul Hassan
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import { C as $Chronos, D as ChronosInput, Tt as TimeUnit } from "../types-CdmsXbU_.cjs";
2
18
 
3
19
  //#region src/plugins/relativeTimePlugin.d.ts
4
20
  declare module 'chronos-date' {
@@ -1,4 +1,20 @@
1
- import { C as $Chronos, D as ChronosInput, Et as TimeUnit } from "../types-B2fgrJ86.mjs";
1
+ /**
2
+ * Copyright 2026 - present Nazmul Hassan
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import { C as $Chronos, D as ChronosInput, Tt as TimeUnit } from "../types-Cb4gxrgJ.mjs";
2
18
 
3
19
  //#region src/plugins/relativeTimePlugin.d.ts
4
20
  declare module 'chronos-date' {
@@ -1 +1,89 @@
1
- import{s as e}from"../basic-e46DaNAi.mjs";const t=t=>{let{toNewDate:n}=t[e];t.prototype.getRelativeYear=function(e){let t=this.toDate(),r=n(this,e),i=t.getFullYear()-r.getFullYear();return(r.getMonth()<t.getMonth()||r.getMonth()===t.getMonth()&&r.getDate()<t.getDate())&&i--,i},t.prototype.getRelativeMonth=function(e){let t=this.toDate(),r=n(this,e),i=(t.getFullYear()-r.getFullYear())*12+(t.getMonth()-r.getMonth());return r.getDate()<t.getDate()&&i--,i},t.prototype.getRelativeWeek=function(e){let t=this.getRelativeDay(e);return Math.floor(t/7)},t.prototype.getRelativeDay=function(e){let t=n(this,e);t.setHours(0,0,0,0);let r=new Date(this.toDate());r.setHours(0,0,0,0);let i=r.getTime()-t.getTime();return Math.floor(i/(1e3*60*60*24))},t.prototype.getRelativeHour=function(e){let t=this.getTimeStamp()-n(this,e).getTime();return Math.floor(t/(1e3*60*60))},t.prototype.getRelativeMinute=function(e){let t=this.getTimeStamp()-n(this,e).getTime();return Math.floor(t/(1e3*60))},t.prototype.getRelativeSecond=function(e){let t=this.getTimeStamp()-n(this,e).getTime();return Math.floor(t/1e3)},t.prototype.getRelativeMilliSecond=function(e){return this.getTimeStamp()-n(this,e).getTime()},t.prototype.compare=function(e=`minute`,t){switch(e){case`year`:return this.getRelativeYear(t);case`month`:return this.getRelativeMonth(t);case`day`:return this.getRelativeDay(t);case`week`:return this.getRelativeWeek(t);case`hour`:return this.getRelativeHour(t);case`minute`:return this.getRelativeMinute(t);case`second`:return this.getRelativeSecond(t);case`millisecond`:return this.getRelativeMilliSecond(t);default:throw RangeError(`Unsupported time unit: ${e}`)}},t.prototype.isToday=function(){return this.getRelativeDay()===0},t.prototype.isTomorrow=function(){return this.getRelativeDay()===1},t.prototype.isYesterday=function(){return this.getRelativeDay()===-1}};export{t as relativeTimePlugin};
1
+ /**
2
+ * Copyright 2026 - present Nazmul Hassan
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import { s as INTERNALS } from "../basic-DqKyujoj.mjs";
18
+
19
+ //#region src/plugins/relativeTimePlugin.ts
20
+ /** * Plugin to inject `relative time` related methods */
21
+ const relativeTimePlugin = ($Chronos) => {
22
+ const { toNewDate } = $Chronos[INTERNALS];
23
+ $Chronos.prototype.getRelativeYear = function(time) {
24
+ const $date = this.toDate();
25
+ const now = toNewDate(this, time);
26
+ let years = $date.getFullYear() - now.getFullYear();
27
+ if (now.getMonth() < $date.getMonth() || now.getMonth() === $date.getMonth() && now.getDate() < $date.getDate()) years--;
28
+ return years;
29
+ };
30
+ $Chronos.prototype.getRelativeMonth = function(time) {
31
+ const $date = this.toDate();
32
+ const now = toNewDate(this, time);
33
+ let months = ($date.getFullYear() - now.getFullYear()) * 12 + ($date.getMonth() - now.getMonth());
34
+ if (now.getDate() < $date.getDate()) months--;
35
+ return months;
36
+ };
37
+ $Chronos.prototype.getRelativeWeek = function(time) {
38
+ const relativeDays = this.getRelativeDay(time);
39
+ return Math.floor(relativeDays / 7);
40
+ };
41
+ $Chronos.prototype.getRelativeDay = function(time) {
42
+ const now = toNewDate(this, time);
43
+ now.setHours(0, 0, 0, 0);
44
+ const $date = new Date(this.toDate());
45
+ $date.setHours(0, 0, 0, 0);
46
+ const diffTime = $date.getTime() - now.getTime();
47
+ return Math.floor(diffTime / (1e3 * 60 * 60 * 24));
48
+ };
49
+ $Chronos.prototype.getRelativeHour = function(time) {
50
+ const diff = this.getTimeStamp() - toNewDate(this, time).getTime();
51
+ return Math.floor(diff / (1e3 * 60 * 60));
52
+ };
53
+ $Chronos.prototype.getRelativeMinute = function(time) {
54
+ const diff = this.getTimeStamp() - toNewDate(this, time).getTime();
55
+ return Math.floor(diff / (1e3 * 60));
56
+ };
57
+ $Chronos.prototype.getRelativeSecond = function(time) {
58
+ const diff = this.getTimeStamp() - toNewDate(this, time).getTime();
59
+ return Math.floor(diff / 1e3);
60
+ };
61
+ $Chronos.prototype.getRelativeMilliSecond = function(time) {
62
+ return this.getTimeStamp() - toNewDate(this, time).getTime();
63
+ };
64
+ $Chronos.prototype.compare = function(unit = "minute", time) {
65
+ switch (unit) {
66
+ case "year": return this.getRelativeYear(time);
67
+ case "month": return this.getRelativeMonth(time);
68
+ case "day": return this.getRelativeDay(time);
69
+ case "week": return this.getRelativeWeek(time);
70
+ case "hour": return this.getRelativeHour(time);
71
+ case "minute": return this.getRelativeMinute(time);
72
+ case "second": return this.getRelativeSecond(time);
73
+ case "millisecond": return this.getRelativeMilliSecond(time);
74
+ default: throw new RangeError(`Unsupported time unit: ${unit}`);
75
+ }
76
+ };
77
+ $Chronos.prototype.isToday = function() {
78
+ return this.getRelativeDay() === 0;
79
+ };
80
+ $Chronos.prototype.isTomorrow = function() {
81
+ return this.getRelativeDay() === 1;
82
+ };
83
+ $Chronos.prototype.isYesterday = function() {
84
+ return this.getRelativeDay() === -1;
85
+ };
86
+ };
87
+
88
+ //#endregion
89
+ export { relativeTimePlugin };
@@ -1 +1,85 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../basic-CKxaRSHQ.cjs`),t=require(`../utilities-D2-p26DX.cjs`),n=n=>{let{internalDate:r,withOrigin:i,offset:a}=n[e.s];n.prototype.round=function(o,s=1){let c=new Date(r(this));switch(o){case`millisecond`:{let e=t.r(c.getMilliseconds(),s);c.setMilliseconds(e);break}case`second`:{let e=t.r(c.getSeconds()+c.getMilliseconds()/1e3,s);c.setSeconds(e,0);break}case`minute`:{let e=t.r(c.getMinutes()+c.getSeconds()/60+c.getMilliseconds()/6e4,s);c.setMinutes(e,0,0);break}case`hour`:{let e=t.r(c.getHours()+c.getMinutes()/60+c.getSeconds()/3600+c.getMilliseconds()/36e5,s);c.setHours(e,0,0,0);break}case`day`:{let n=t.r(c.getDate()+(c.getHours()/24+c.getMinutes()/1440+c.getSeconds()/86400+c.getMilliseconds()/e.u),s);c.setDate(n),c.setHours(0,0,0,0);break}case`week`:{let e=(c.getDay()+6)%7,t=new Date(c);t.setDate(t.getDate()-e),t.setHours(0,0,0,0);let r=new Date(t);r.setDate(r.getDate()+7);let a=Math.abs(c.getTime()-t.getTime());return i(new n(Math.abs(r.getTime()-c.getTime())<a?r:t),`round`)}case`month`:{let e=t.r(c.getMonth()+c.getDate()/this.lastDateOfMonth,s);c.setMonth(e,1),c.setHours(0,0,0,0);break}case`year`:{let n=Math.floor((c.getTime()-new Date(c.getFullYear(),0,1).getTime())/e.u),r=new Date(c.getFullYear(),1,29).getDate()===29?366:365,i=t.r(c.getFullYear()+n/r,s);c.setFullYear(i,0,1),c.setHours(0,0,0,0);break}default:return this}return i(new n(c),`round`,a(this),this.timeZoneName,this.timeZoneId,this.$tzTracker)}};exports.roundPlugin=n;
1
+ /**
2
+ * Copyright 2026 - present Nazmul Hassan
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
18
+ const require_basic = require('../basic-DsQqC5nZ.cjs');
19
+ const require_utilities = require('../utilities-CpF3uys3.cjs');
20
+
21
+ //#region src/plugins/roundPlugin.ts
22
+ /** * Plugin to inject `round` method */
23
+ const roundPlugin = ($Chronos) => {
24
+ const { internalDate, withOrigin, offset } = $Chronos[require_basic.INTERNALS];
25
+ $Chronos.prototype.round = function(unit, nearest = 1) {
26
+ const date = new Date(internalDate(this));
27
+ switch (unit) {
28
+ case "millisecond": {
29
+ const rounded = require_utilities.roundToNearest(date.getMilliseconds(), nearest);
30
+ date.setMilliseconds(rounded);
31
+ break;
32
+ }
33
+ case "second": {
34
+ const rounded = require_utilities.roundToNearest(date.getSeconds() + date.getMilliseconds() / 1e3, nearest);
35
+ date.setSeconds(rounded, 0);
36
+ break;
37
+ }
38
+ case "minute": {
39
+ const rounded = require_utilities.roundToNearest(date.getMinutes() + date.getSeconds() / 60 + date.getMilliseconds() / 6e4, nearest);
40
+ date.setMinutes(rounded, 0, 0);
41
+ break;
42
+ }
43
+ case "hour": {
44
+ const rounded = require_utilities.roundToNearest(date.getHours() + date.getMinutes() / 60 + date.getSeconds() / 3600 + date.getMilliseconds() / 36e5, nearest);
45
+ date.setHours(rounded, 0, 0, 0);
46
+ break;
47
+ }
48
+ case "day": {
49
+ const rounded = require_utilities.roundToNearest(date.getDate() + (date.getHours() / 24 + date.getMinutes() / 1440 + date.getSeconds() / 86400 + date.getMilliseconds() / require_basic.MS_PER_DAY), nearest);
50
+ date.setDate(rounded);
51
+ date.setHours(0, 0, 0, 0);
52
+ break;
53
+ }
54
+ case "week": {
55
+ const offsetToMonday = (date.getDay() + 6) % 7;
56
+ const startOfWeek = new Date(date);
57
+ startOfWeek.setDate(startOfWeek.getDate() - offsetToMonday);
58
+ startOfWeek.setHours(0, 0, 0, 0);
59
+ const endOfWeek = new Date(startOfWeek);
60
+ endOfWeek.setDate(endOfWeek.getDate() + 7);
61
+ const diffToStart = Math.abs(date.getTime() - startOfWeek.getTime());
62
+ return withOrigin(new $Chronos(Math.abs(endOfWeek.getTime() - date.getTime()) < diffToStart ? endOfWeek : startOfWeek), "round");
63
+ }
64
+ case "month": {
65
+ const roundedMonth = require_utilities.roundToNearest(date.getMonth() + date.getDate() / this.lastDateOfMonth, nearest);
66
+ date.setMonth(roundedMonth, 1);
67
+ date.setHours(0, 0, 0, 0);
68
+ break;
69
+ }
70
+ case "year": {
71
+ const dayOfYear = Math.floor((date.getTime() - new Date(date.getFullYear(), 0, 1).getTime()) / require_basic.MS_PER_DAY);
72
+ const totalDays = new Date(date.getFullYear(), 1, 29).getDate() === 29 ? 366 : 365;
73
+ const roundedYear = require_utilities.roundToNearest(date.getFullYear() + dayOfYear / totalDays, nearest);
74
+ date.setFullYear(roundedYear, 0, 1);
75
+ date.setHours(0, 0, 0, 0);
76
+ break;
77
+ }
78
+ default: return this;
79
+ }
80
+ return withOrigin(new $Chronos(date), "round", offset(this), this.timeZoneName, this.timeZoneId, this.$tzTracker);
81
+ };
82
+ };
83
+
84
+ //#endregion
85
+ exports.roundPlugin = roundPlugin;
@@ -1,4 +1,20 @@
1
- import { C as $Chronos, Et as TimeUnit } from "../types-DPTQ_yLx.cjs";
1
+ /**
2
+ * Copyright 2026 - present Nazmul Hassan
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import { C as $Chronos, Tt as TimeUnit } from "../types-CdmsXbU_.cjs";
2
18
 
3
19
  //#region src/plugins/roundPlugin.d.ts
4
20
  declare module 'chronos-date' {
@@ -1,4 +1,20 @@
1
- import { C as $Chronos, Et as TimeUnit } from "../types-B2fgrJ86.mjs";
1
+ /**
2
+ * Copyright 2026 - present Nazmul Hassan
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import { C as $Chronos, Tt as TimeUnit } from "../types-Cb4gxrgJ.mjs";
2
18
 
3
19
  //#region src/plugins/roundPlugin.d.ts
4
20
  declare module 'chronos-date' {
@@ -1 +1,84 @@
1
- import{s as e,u as t}from"../basic-e46DaNAi.mjs";import{r as n}from"../utilities-BJE06bms.mjs";const r=r=>{let{internalDate:i,withOrigin:a,offset:o}=r[e];r.prototype.round=function(e,s=1){let c=new Date(i(this));switch(e){case`millisecond`:{let e=n(c.getMilliseconds(),s);c.setMilliseconds(e);break}case`second`:{let e=n(c.getSeconds()+c.getMilliseconds()/1e3,s);c.setSeconds(e,0);break}case`minute`:{let e=n(c.getMinutes()+c.getSeconds()/60+c.getMilliseconds()/6e4,s);c.setMinutes(e,0,0);break}case`hour`:{let e=n(c.getHours()+c.getMinutes()/60+c.getSeconds()/3600+c.getMilliseconds()/36e5,s);c.setHours(e,0,0,0);break}case`day`:{let e=n(c.getDate()+(c.getHours()/24+c.getMinutes()/1440+c.getSeconds()/86400+c.getMilliseconds()/t),s);c.setDate(e),c.setHours(0,0,0,0);break}case`week`:{let e=(c.getDay()+6)%7,t=new Date(c);t.setDate(t.getDate()-e),t.setHours(0,0,0,0);let n=new Date(t);n.setDate(n.getDate()+7);let i=Math.abs(c.getTime()-t.getTime());return a(new r(Math.abs(n.getTime()-c.getTime())<i?n:t),`round`)}case`month`:{let e=n(c.getMonth()+c.getDate()/this.lastDateOfMonth,s);c.setMonth(e,1),c.setHours(0,0,0,0);break}case`year`:{let e=Math.floor((c.getTime()-new Date(c.getFullYear(),0,1).getTime())/t),r=new Date(c.getFullYear(),1,29).getDate()===29?366:365,i=n(c.getFullYear()+e/r,s);c.setFullYear(i,0,1),c.setHours(0,0,0,0);break}default:return this}return a(new r(c),`round`,o(this),this.timeZoneName,this.timeZoneId,this.$tzTracker)}};export{r as roundPlugin};
1
+ /**
2
+ * Copyright 2026 - present Nazmul Hassan
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import { s as INTERNALS, u as MS_PER_DAY } from "../basic-DqKyujoj.mjs";
18
+ import { r as roundToNearest } from "../utilities-BKtVo78T.mjs";
19
+
20
+ //#region src/plugins/roundPlugin.ts
21
+ /** * Plugin to inject `round` method */
22
+ const roundPlugin = ($Chronos) => {
23
+ const { internalDate, withOrigin, offset } = $Chronos[INTERNALS];
24
+ $Chronos.prototype.round = function(unit, nearest = 1) {
25
+ const date = new Date(internalDate(this));
26
+ switch (unit) {
27
+ case "millisecond": {
28
+ const rounded = roundToNearest(date.getMilliseconds(), nearest);
29
+ date.setMilliseconds(rounded);
30
+ break;
31
+ }
32
+ case "second": {
33
+ const rounded = roundToNearest(date.getSeconds() + date.getMilliseconds() / 1e3, nearest);
34
+ date.setSeconds(rounded, 0);
35
+ break;
36
+ }
37
+ case "minute": {
38
+ const rounded = roundToNearest(date.getMinutes() + date.getSeconds() / 60 + date.getMilliseconds() / 6e4, nearest);
39
+ date.setMinutes(rounded, 0, 0);
40
+ break;
41
+ }
42
+ case "hour": {
43
+ const rounded = roundToNearest(date.getHours() + date.getMinutes() / 60 + date.getSeconds() / 3600 + date.getMilliseconds() / 36e5, nearest);
44
+ date.setHours(rounded, 0, 0, 0);
45
+ break;
46
+ }
47
+ case "day": {
48
+ const rounded = roundToNearest(date.getDate() + (date.getHours() / 24 + date.getMinutes() / 1440 + date.getSeconds() / 86400 + date.getMilliseconds() / MS_PER_DAY), nearest);
49
+ date.setDate(rounded);
50
+ date.setHours(0, 0, 0, 0);
51
+ break;
52
+ }
53
+ case "week": {
54
+ const offsetToMonday = (date.getDay() + 6) % 7;
55
+ const startOfWeek = new Date(date);
56
+ startOfWeek.setDate(startOfWeek.getDate() - offsetToMonday);
57
+ startOfWeek.setHours(0, 0, 0, 0);
58
+ const endOfWeek = new Date(startOfWeek);
59
+ endOfWeek.setDate(endOfWeek.getDate() + 7);
60
+ const diffToStart = Math.abs(date.getTime() - startOfWeek.getTime());
61
+ return withOrigin(new $Chronos(Math.abs(endOfWeek.getTime() - date.getTime()) < diffToStart ? endOfWeek : startOfWeek), "round");
62
+ }
63
+ case "month": {
64
+ const roundedMonth = roundToNearest(date.getMonth() + date.getDate() / this.lastDateOfMonth, nearest);
65
+ date.setMonth(roundedMonth, 1);
66
+ date.setHours(0, 0, 0, 0);
67
+ break;
68
+ }
69
+ case "year": {
70
+ const dayOfYear = Math.floor((date.getTime() - new Date(date.getFullYear(), 0, 1).getTime()) / MS_PER_DAY);
71
+ const totalDays = new Date(date.getFullYear(), 1, 29).getDate() === 29 ? 366 : 365;
72
+ const roundedYear = roundToNearest(date.getFullYear() + dayOfYear / totalDays, nearest);
73
+ date.setFullYear(roundedYear, 0, 1);
74
+ date.setHours(0, 0, 0, 0);
75
+ break;
76
+ }
77
+ default: return this;
78
+ }
79
+ return withOrigin(new $Chronos(date), "round", offset(this), this.timeZoneName, this.timeZoneId, this.$tzTracker);
80
+ };
81
+ };
82
+
83
+ //#endregion
84
+ export { roundPlugin };
@@ -1 +1,47 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../seasons-oABOhHcX.cjs`),t=t=>{t.prototype.season=function(t){let{preset:n=`default`}=t??{},r=t?.seasons??e.u[n],i=this.format(`MM-DD`);for(let{name:e,boundary:t}of r)if(`startDate`in t&&`endDate`in t){let n=t.startDate,r=t.endDate;if(n<=r){if(i>=n&&i<=r)return e}else if(i>=n||i<=r)return e}else if(`startMonth`in t&&`endMonth`in t){let{startMonth:n,endMonth:r}=t;if(n<=r){if(this.month>=n&&this.month<=r)return e}else if(this.month>=n||this.month<=r)return e}return`Unknown`},t.prototype.getSeasonName=function(e){return this.season(e)}};exports.seasonPlugin=t;
1
+ /**
2
+ * Copyright 2026 - present Nazmul Hassan
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
18
+ const require_seasons = require('../seasons-B7kK88zq.cjs');
19
+
20
+ //#region src/plugins/seasonPlugin.ts
21
+ /** * Plugin to inject `season`/`getSeasonName` method */
22
+ const seasonPlugin = ($Chronos) => {
23
+ $Chronos.prototype.season = function(options) {
24
+ const { preset = "default" } = options ?? {};
25
+ const seasonSet = options?.seasons ?? require_seasons.SEASON_PRESETS[preset];
26
+ const dateStr = this.format("MM-DD");
27
+ for (const { name, boundary } of seasonSet) if ("startDate" in boundary && "endDate" in boundary) {
28
+ const start = boundary.startDate;
29
+ const end = boundary.endDate;
30
+ if (start <= end) {
31
+ if (dateStr >= start && dateStr <= end) return name;
32
+ } else if (dateStr >= start || dateStr <= end) return name;
33
+ } else if ("startMonth" in boundary && "endMonth" in boundary) {
34
+ const { startMonth, endMonth } = boundary;
35
+ if (startMonth <= endMonth) {
36
+ if (this.month >= startMonth && this.month <= endMonth) return name;
37
+ } else if (this.month >= startMonth || this.month <= endMonth) return name;
38
+ }
39
+ return "Unknown";
40
+ };
41
+ $Chronos.prototype.getSeasonName = function(options) {
42
+ return this.season(options);
43
+ };
44
+ };
45
+
46
+ //#endregion
47
+ exports.seasonPlugin = seasonPlugin;
@@ -1,4 +1,20 @@
1
- import { C as $Chronos, m as SeasonOptions } from "../types-DPTQ_yLx.cjs";
1
+ /**
2
+ * Copyright 2026 - present Nazmul Hassan
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import { C as $Chronos, m as SeasonOptions } from "../types-CdmsXbU_.cjs";
2
18
 
3
19
  //#region src/plugins/seasonPlugin.d.ts
4
20
  declare module 'chronos-date' {
@@ -1,4 +1,20 @@
1
- import { C as $Chronos, m as SeasonOptions } from "../types-B2fgrJ86.mjs";
1
+ /**
2
+ * Copyright 2026 - present Nazmul Hassan
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import { C as $Chronos, m as SeasonOptions } from "../types-Cb4gxrgJ.mjs";
2
18
 
3
19
  //#region src/plugins/seasonPlugin.d.ts
4
20
  declare module 'chronos-date' {
@@ -1 +1,46 @@
1
- import{u as e}from"../seasons-ChAIVphi.mjs";const t=t=>{t.prototype.season=function(t){let{preset:n=`default`}=t??{},r=t?.seasons??e[n],i=this.format(`MM-DD`);for(let{name:e,boundary:t}of r)if(`startDate`in t&&`endDate`in t){let n=t.startDate,r=t.endDate;if(n<=r){if(i>=n&&i<=r)return e}else if(i>=n||i<=r)return e}else if(`startMonth`in t&&`endMonth`in t){let{startMonth:n,endMonth:r}=t;if(n<=r){if(this.month>=n&&this.month<=r)return e}else if(this.month>=n||this.month<=r)return e}return`Unknown`},t.prototype.getSeasonName=function(e){return this.season(e)}};export{t as seasonPlugin};
1
+ /**
2
+ * Copyright 2026 - present Nazmul Hassan
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import { u as SEASON_PRESETS } from "../seasons-Cq3ah3pV.mjs";
18
+
19
+ //#region src/plugins/seasonPlugin.ts
20
+ /** * Plugin to inject `season`/`getSeasonName` method */
21
+ const seasonPlugin = ($Chronos) => {
22
+ $Chronos.prototype.season = function(options) {
23
+ const { preset = "default" } = options ?? {};
24
+ const seasonSet = options?.seasons ?? SEASON_PRESETS[preset];
25
+ const dateStr = this.format("MM-DD");
26
+ for (const { name, boundary } of seasonSet) if ("startDate" in boundary && "endDate" in boundary) {
27
+ const start = boundary.startDate;
28
+ const end = boundary.endDate;
29
+ if (start <= end) {
30
+ if (dateStr >= start && dateStr <= end) return name;
31
+ } else if (dateStr >= start || dateStr <= end) return name;
32
+ } else if ("startMonth" in boundary && "endMonth" in boundary) {
33
+ const { startMonth, endMonth } = boundary;
34
+ if (startMonth <= endMonth) {
35
+ if (this.month >= startMonth && this.month <= endMonth) return name;
36
+ } else if (this.month >= startMonth || this.month <= endMonth) return name;
37
+ }
38
+ return "Unknown";
39
+ };
40
+ $Chronos.prototype.getSeasonName = function(options) {
41
+ return this.season(options);
42
+ };
43
+ };
44
+
45
+ //#endregion
46
+ export { seasonPlugin };