@duplojs/utils 1.3.29 → 1.3.30

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 (212) hide show
  1. package/dist/clean/index.cjs +13 -0
  2. package/dist/clean/index.mjs +7 -1
  3. package/dist/clean/primitive/base.cjs +3 -0
  4. package/dist/clean/primitive/base.d.ts +4 -2
  5. package/dist/clean/primitive/base.mjs +3 -1
  6. package/dist/clean/primitive/operations/date/dateAddTime.cjs +16 -0
  7. package/dist/clean/primitive/operations/date/dateAddTime.d.ts +4 -0
  8. package/dist/clean/primitive/operations/date/dateAddTime.mjs +14 -0
  9. package/dist/clean/primitive/operations/date/dateMax.cjs +1 -5
  10. package/dist/clean/primitive/operations/date/dateMax.d.ts +1 -2
  11. package/dist/clean/primitive/operations/date/dateMax.mjs +1 -5
  12. package/dist/clean/primitive/operations/date/dateMin.cjs +1 -5
  13. package/dist/clean/primitive/operations/date/dateMin.d.ts +1 -2
  14. package/dist/clean/primitive/operations/date/dateMin.mjs +1 -5
  15. package/dist/clean/primitive/operations/date/dateSubtractTime.cjs +16 -0
  16. package/dist/clean/primitive/operations/date/dateSubtractTime.d.ts +4 -0
  17. package/dist/clean/primitive/operations/date/dateSubtractTime.mjs +14 -0
  18. package/dist/clean/primitive/operations/date/index.d.ts +2 -4
  19. package/dist/clean/primitive/operations/equal.d.ts +3 -3
  20. package/dist/clean/primitive/operations/index.d.ts +1 -0
  21. package/dist/clean/primitive/operations/sort.cjs +6 -0
  22. package/dist/clean/primitive/operations/sort.d.ts +4 -8
  23. package/dist/clean/primitive/operations/sort.mjs +6 -0
  24. package/dist/clean/primitive/operations/time/index.d.ts +4 -0
  25. package/dist/clean/primitive/operations/time/timeGreaterThan.cjs +15 -0
  26. package/dist/clean/primitive/operations/time/timeGreaterThan.d.ts +4 -0
  27. package/dist/clean/primitive/operations/time/timeGreaterThan.mjs +13 -0
  28. package/dist/clean/primitive/operations/time/timeLessThan.cjs +15 -0
  29. package/dist/clean/primitive/operations/time/timeLessThan.d.ts +4 -0
  30. package/dist/clean/primitive/operations/time/timeLessThan.mjs +13 -0
  31. package/dist/clean/primitive/operations/time/timeMax.cjs +12 -0
  32. package/dist/clean/primitive/operations/time/timeMax.d.ts +4 -0
  33. package/dist/clean/primitive/operations/time/timeMax.mjs +10 -0
  34. package/dist/clean/primitive/operations/time/timeMin.cjs +12 -0
  35. package/dist/clean/primitive/operations/time/timeMin.d.ts +4 -0
  36. package/dist/clean/primitive/operations/time/timeMin.mjs +10 -0
  37. package/dist/common/toWrappedValue.d.ts +2 -1
  38. package/dist/dataParser/extended/coerce/index.cjs +2 -0
  39. package/dist/dataParser/extended/coerce/index.d.ts +1 -0
  40. package/dist/dataParser/extended/coerce/index.mjs +1 -0
  41. package/dist/dataParser/extended/coerce/time.cjs +12 -0
  42. package/dist/dataParser/extended/coerce/time.d.ts +7 -0
  43. package/dist/dataParser/extended/coerce/time.mjs +10 -0
  44. package/dist/dataParser/extended/index.cjs +2 -0
  45. package/dist/dataParser/extended/index.d.ts +1 -0
  46. package/dist/dataParser/extended/index.mjs +1 -0
  47. package/dist/dataParser/extended/time.cjs +22 -0
  48. package/dist/dataParser/extended/time.d.ts +34 -0
  49. package/dist/dataParser/extended/time.mjs +20 -0
  50. package/dist/dataParser/identifier.d.ts +10 -4
  51. package/dist/dataParser/index.cjs +33 -24
  52. package/dist/dataParser/index.mjs +3 -0
  53. package/dist/dataParser/parsers/coerce/index.cjs +2 -0
  54. package/dist/dataParser/parsers/coerce/index.d.ts +1 -0
  55. package/dist/dataParser/parsers/coerce/index.mjs +1 -0
  56. package/dist/dataParser/parsers/coerce/time.cjs +12 -0
  57. package/dist/dataParser/parsers/coerce/time.d.ts +6 -0
  58. package/dist/dataParser/parsers/coerce/time.mjs +10 -0
  59. package/dist/dataParser/parsers/date.cjs +6 -12
  60. package/dist/dataParser/parsers/date.mjs +6 -12
  61. package/dist/dataParser/parsers/index.d.ts +1 -0
  62. package/dist/dataParser/parsers/time/checkers/index.d.ts +2 -0
  63. package/dist/dataParser/parsers/time/checkers/max.cjs +19 -0
  64. package/dist/dataParser/parsers/time/checkers/max.d.ts +12 -0
  65. package/dist/dataParser/parsers/time/checkers/max.mjs +16 -0
  66. package/dist/dataParser/parsers/time/checkers/min.cjs +19 -0
  67. package/dist/dataParser/parsers/time/checkers/min.d.ts +12 -0
  68. package/dist/dataParser/parsers/time/checkers/min.mjs +16 -0
  69. package/dist/dataParser/parsers/time/index.cjs +47 -0
  70. package/dist/dataParser/parsers/time/index.d.ts +33 -0
  71. package/dist/dataParser/parsers/time/index.mjs +44 -0
  72. package/dist/dataParser/types/checkers.d.ts +1 -1
  73. package/dist/dataParser/types/dataParsers.d.ts +2 -2
  74. package/dist/date/applyTimezone.cjs +17 -0
  75. package/dist/date/applyTimezone.d.ts +4 -0
  76. package/dist/date/applyTimezone.mjs +15 -0
  77. package/dist/date/constants.cjs +13 -3
  78. package/dist/date/constants.d.ts +6 -1
  79. package/dist/date/constants.mjs +9 -4
  80. package/dist/date/create.cjs +62 -29
  81. package/dist/date/create.d.ts +10 -6
  82. package/dist/date/create.mjs +60 -27
  83. package/dist/date/createOrThrow.cjs +4 -1
  84. package/dist/date/createOrThrow.d.ts +5 -4
  85. package/dist/date/createOrThrow.mjs +4 -1
  86. package/dist/date/createTheDate.cjs +10 -0
  87. package/dist/date/createTheDate.d.ts +2 -0
  88. package/dist/date/createTheDate.mjs +8 -0
  89. package/dist/date/createTheTime.cjs +10 -0
  90. package/dist/date/createTheTime.d.ts +2 -0
  91. package/dist/date/createTheTime.mjs +8 -0
  92. package/dist/date/createTime.cjs +61 -0
  93. package/dist/date/createTime.d.ts +44 -0
  94. package/dist/date/createTime.mjs +59 -0
  95. package/dist/date/createTimeOrThrow.cjs +28 -0
  96. package/dist/date/createTimeOrThrow.d.ts +10 -0
  97. package/dist/date/createTimeOrThrow.mjs +25 -0
  98. package/dist/date/format.cjs +37 -0
  99. package/dist/date/format.d.ts +4 -0
  100. package/dist/date/format.mjs +35 -0
  101. package/dist/date/getTimezoneOffset.cjs +27 -0
  102. package/dist/date/getTimezoneOffset.d.ts +4 -0
  103. package/dist/date/getTimezoneOffset.mjs +25 -0
  104. package/dist/date/getters/getDayOfYear.cjs +2 -1
  105. package/dist/date/getters/getDayOfYear.mjs +2 -1
  106. package/dist/date/index.cjs +51 -2
  107. package/dist/date/index.d.ts +15 -0
  108. package/dist/date/index.mjs +25 -3
  109. package/dist/date/is.cjs +9 -1
  110. package/dist/date/is.mjs +9 -1
  111. package/dist/date/isSafeTimeValue.cjs +15 -0
  112. package/dist/date/isSafeTimeValue.d.ts +1 -0
  113. package/dist/date/isSafeTimeValue.mjs +13 -0
  114. package/dist/date/isSafeTimestamp.cjs +3 -3
  115. package/dist/date/isSafeTimestamp.d.ts +1 -1
  116. package/dist/date/isSafeTimestamp.mjs +3 -3
  117. package/dist/date/isTime.cjs +17 -0
  118. package/dist/date/isTime.d.ts +2 -0
  119. package/dist/date/isTime.mjs +15 -0
  120. package/dist/date/makeSafeTimeValue.cjs +20 -0
  121. package/dist/date/makeSafeTimeValue.d.ts +1 -0
  122. package/dist/date/makeSafeTimeValue.mjs +18 -0
  123. package/dist/date/makeSafeTimestamp.cjs +20 -0
  124. package/dist/date/makeSafeTimestamp.d.ts +1 -0
  125. package/dist/date/makeSafeTimestamp.mjs +18 -0
  126. package/dist/date/maxTime.cjs +10 -0
  127. package/dist/date/maxTime.d.ts +3 -0
  128. package/dist/date/maxTime.mjs +8 -0
  129. package/dist/date/minTime.cjs +10 -0
  130. package/dist/date/minTime.d.ts +3 -0
  131. package/dist/date/minTime.mjs +8 -0
  132. package/dist/date/operators/addDays.cjs +2 -3
  133. package/dist/date/operators/addDays.mjs +2 -3
  134. package/dist/date/operators/addHours.cjs +2 -3
  135. package/dist/date/operators/addHours.mjs +2 -3
  136. package/dist/date/operators/addMilliseconds.cjs +2 -3
  137. package/dist/date/operators/addMilliseconds.mjs +2 -3
  138. package/dist/date/operators/addMinutes.cjs +2 -3
  139. package/dist/date/operators/addMinutes.mjs +2 -3
  140. package/dist/date/operators/addMonths.cjs +2 -3
  141. package/dist/date/operators/addMonths.mjs +2 -3
  142. package/dist/date/operators/addSeconds.cjs +2 -3
  143. package/dist/date/operators/addSeconds.mjs +2 -3
  144. package/dist/date/operators/addTime.cjs +21 -0
  145. package/dist/date/operators/addTime.d.ts +5 -0
  146. package/dist/date/operators/addTime.mjs +19 -0
  147. package/dist/date/operators/addWeeks.cjs +2 -3
  148. package/dist/date/operators/addWeeks.mjs +2 -3
  149. package/dist/date/operators/addYears.cjs +2 -3
  150. package/dist/date/operators/addYears.mjs +2 -3
  151. package/dist/date/operators/betweenThanTime.cjs +17 -0
  152. package/dist/date/operators/betweenThanTime.d.ts +3 -0
  153. package/dist/date/operators/betweenThanTime.mjs +15 -0
  154. package/dist/date/operators/betweenTime.cjs +17 -0
  155. package/dist/date/operators/betweenTime.d.ts +3 -0
  156. package/dist/date/operators/betweenTime.mjs +15 -0
  157. package/dist/date/operators/greaterThanTime.cjs +16 -0
  158. package/dist/date/operators/greaterThanTime.d.ts +3 -0
  159. package/dist/date/operators/greaterThanTime.mjs +14 -0
  160. package/dist/date/operators/greaterTime.cjs +16 -0
  161. package/dist/date/operators/greaterTime.d.ts +3 -0
  162. package/dist/date/operators/greaterTime.mjs +14 -0
  163. package/dist/date/operators/index.d.ts +8 -0
  164. package/dist/date/operators/lessThanTime.cjs +16 -0
  165. package/dist/date/operators/lessThanTime.d.ts +3 -0
  166. package/dist/date/operators/lessThanTime.mjs +14 -0
  167. package/dist/date/operators/lessTime.cjs +16 -0
  168. package/dist/date/operators/lessTime.d.ts +3 -0
  169. package/dist/date/operators/lessTime.mjs +14 -0
  170. package/dist/date/operators/subtractDays.cjs +2 -3
  171. package/dist/date/operators/subtractDays.mjs +2 -3
  172. package/dist/date/operators/subtractHours.cjs +2 -3
  173. package/dist/date/operators/subtractHours.mjs +2 -3
  174. package/dist/date/operators/subtractMilliseconds.cjs +2 -3
  175. package/dist/date/operators/subtractMilliseconds.mjs +2 -3
  176. package/dist/date/operators/subtractMinutes.cjs +2 -3
  177. package/dist/date/operators/subtractMinutes.mjs +2 -3
  178. package/dist/date/operators/subtractMonths.cjs +2 -3
  179. package/dist/date/operators/subtractMonths.mjs +2 -3
  180. package/dist/date/operators/subtractSeconds.cjs +2 -3
  181. package/dist/date/operators/subtractSeconds.mjs +2 -3
  182. package/dist/date/operators/subtractTime.cjs +21 -0
  183. package/dist/date/operators/subtractTime.d.ts +5 -0
  184. package/dist/date/operators/subtractTime.mjs +19 -0
  185. package/dist/date/operators/subtractWeeks.cjs +2 -3
  186. package/dist/date/operators/subtractWeeks.mjs +2 -3
  187. package/dist/date/operators/subtractYears.cjs +2 -3
  188. package/dist/date/operators/subtractYears.mjs +2 -3
  189. package/dist/date/sortTimes.cjs +20 -0
  190. package/dist/date/sortTimes.d.ts +4 -0
  191. package/dist/date/sortTimes.mjs +18 -0
  192. package/dist/date/{types/timezone.cjs → timezone.cjs} +1 -1
  193. package/dist/date/{types/timezone.d.ts → timezone.d.ts} +1 -1
  194. package/dist/date/{types/timezone.mjs → timezone.mjs} +1 -1
  195. package/dist/date/toTimeValue.cjs +14 -0
  196. package/dist/date/toTimeValue.d.ts +2 -0
  197. package/dist/date/toTimeValue.mjs +12 -0
  198. package/dist/date/toTimestamp.cjs +6 -21
  199. package/dist/date/toTimestamp.d.ts +0 -8
  200. package/dist/date/toTimestamp.mjs +8 -22
  201. package/dist/date/types/index.d.ts +3 -1
  202. package/dist/date/types/isSafeYear.d.ts +5 -52
  203. package/dist/date/types/spoolingDate.d.ts +12 -0
  204. package/dist/date/types/spoolingTime.d.ts +9 -0
  205. package/dist/date/types/theTime.d.ts +1 -0
  206. package/dist/metadata.json +359 -5
  207. package/dist/number/types/index.d.ts +2 -0
  208. package/dist/number/types/isGreater.d.ts +50 -0
  209. package/dist/number/types/isLess.d.ts +3 -0
  210. package/dist/string/types/index.d.ts +1 -0
  211. package/dist/string/types/replace.d.ts +1 -0
  212. package/package.json +1 -1
@@ -1,3 +1,4 @@
1
+ import { createTheDate } from '../createTheDate.mjs';
1
2
  import { toNative } from '../toNative.mjs';
2
3
 
3
4
  function subtractYears(...args) {
@@ -8,9 +9,7 @@ function subtractYears(...args) {
8
9
  const [input, year] = args;
9
10
  const date = toNative(input);
10
11
  date.setUTCFullYear(date.getUTCFullYear() - year);
11
- const timestamp = date.getTime();
12
- const isNegative = timestamp < 0;
13
- return `date${Math.abs(timestamp)}${isNegative ? "-" : "+"}`;
12
+ return createTheDate(date.getTime());
14
13
  }
15
14
 
16
15
  export { subtractYears };
@@ -0,0 +1,20 @@
1
+ 'use strict';
2
+
3
+ var createTheTime = require('./createTheTime.cjs');
4
+ var toTimeValue = require('./toTimeValue.cjs');
5
+
6
+ function sortTimes(...args) {
7
+ if (args.length === 1) {
8
+ const [type] = args;
9
+ return (array) => sortTimes(array, type);
10
+ }
11
+ const [array, type] = args;
12
+ return array
13
+ .map(toTimeValue.toTimeValue)
14
+ .sort(type === "DSC"
15
+ ? (first, second) => second - first
16
+ : (first, second) => first - second)
17
+ .map(createTheTime.createTheTime);
18
+ }
19
+
20
+ exports.sortTimes = sortTimes;
@@ -0,0 +1,4 @@
1
+ import { type SortType } from "../common";
2
+ import { type TheTime } from "./types";
3
+ export declare function sortTimes<GenericArray extends readonly TheTime[]>(type: SortType): (array: GenericArray) => TheTime[];
4
+ export declare function sortTimes<GenericArray extends readonly TheTime[]>(array: GenericArray, type: SortType): TheTime[];
@@ -0,0 +1,18 @@
1
+ import { createTheTime } from './createTheTime.mjs';
2
+ import { toTimeValue } from './toTimeValue.mjs';
3
+
4
+ function sortTimes(...args) {
5
+ if (args.length === 1) {
6
+ const [type] = args;
7
+ return (array) => sortTimes(array, type);
8
+ }
9
+ const [array, type] = args;
10
+ return array
11
+ .map(toTimeValue)
12
+ .sort(type === "DSC"
13
+ ? (first, second) => second - first
14
+ : (first, second) => first - second)
15
+ .map(createTheTime);
16
+ }
17
+
18
+ export { sortTimes };
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var _enum = require('../../common/enum.cjs');
3
+ var _enum = require('../common/enum.cjs');
4
4
 
5
5
  const timezone = _enum.createEnum([
6
6
  "Africa/Abidjan",
@@ -1,4 +1,4 @@
1
- import { type GetEnumValue } from "../../common/enum";
1
+ import { type GetEnumValue } from "../common/enum";
2
2
  export declare const timezone: {
3
3
  "Africa/Abidjan": "Africa/Abidjan";
4
4
  "Africa/Accra": "Africa/Accra";
@@ -1,4 +1,4 @@
1
- import { createEnum } from '../../common/enum.mjs';
1
+ import { createEnum } from '../common/enum.mjs';
2
2
 
3
3
  const timezone = createEnum([
4
4
  "Africa/Abidjan",
@@ -0,0 +1,14 @@
1
+ 'use strict';
2
+
3
+ var constants = require('./constants.cjs');
4
+ var makeSafeTimeValue = require('./makeSafeTimeValue.cjs');
5
+
6
+ function toTimeValue(input) {
7
+ const match = input.match(constants.theTimeRegex);
8
+ const { value, sign } = match.groups;
9
+ return makeSafeTimeValue.makeSafeTimeValue(Number(sign === "-"
10
+ ? `-${value}`
11
+ : value));
12
+ }
13
+
14
+ exports.toTimeValue = toTimeValue;
@@ -0,0 +1,2 @@
1
+ import { type TheTime } from "./types";
2
+ export declare function toTimeValue<GenericInput extends TheTime>(input: GenericInput): number;
@@ -0,0 +1,12 @@
1
+ import { theTimeRegex } from './constants.mjs';
2
+ import { makeSafeTimeValue } from './makeSafeTimeValue.mjs';
3
+
4
+ function toTimeValue(input) {
5
+ const match = input.match(theTimeRegex);
6
+ const { value, sign } = match.groups;
7
+ return makeSafeTimeValue(Number(sign === "-"
8
+ ? `-${value}`
9
+ : value));
10
+ }
11
+
12
+ export { toTimeValue };
@@ -1,31 +1,16 @@
1
1
  'use strict';
2
2
 
3
3
  var constants = require('./constants.cjs');
4
- var isSafeTimestamp = require('./isSafeTimestamp.cjs');
5
- var kind = require('../common/kind.cjs');
6
- var errorKindNamespace = require('../common/errorKindNamespace.cjs');
4
+ var makeSafeTimestamp = require('./makeSafeTimestamp.cjs');
7
5
 
8
- class InvalidTheDateError extends kind.kindHeritage("invalid-the-Date-error", errorKindNamespace.createErrorKind("invalid-the-Date-error"), Error) {
9
- theDate;
10
- constructor(theDate) {
11
- super({}, ["TheDate is invalid."]);
12
- this.theDate = theDate;
13
- }
14
- }
15
6
  function toTimestamp(input) {
16
- const match = input.match(constants.theDateRegex);
17
- if (!match) {
18
- throw new InvalidTheDateError(input);
19
- }
7
+ const match = input.startsWith("date")
8
+ ? input.match(constants.theDateRegex)
9
+ : input.match(constants.theTimeRegex);
20
10
  const { value, sign } = match.groups;
21
- const timestamp = Number(sign === "-"
11
+ return makeSafeTimestamp.makeSafeTimestamp(Number(sign === "-"
22
12
  ? `-${value}`
23
- : value);
24
- if (!isSafeTimestamp.isSafeTimestamp(timestamp)) {
25
- throw new InvalidTheDateError(input);
26
- }
27
- return timestamp;
13
+ : value));
28
14
  }
29
15
 
30
- exports.InvalidTheDateError = InvalidTheDateError;
31
16
  exports.toTimestamp = toTimestamp;
@@ -1,10 +1,2 @@
1
1
  import type { TheDate } from "./types";
2
- declare const InvalidTheDateError_base: new (params: {
3
- "@DuplojsUtilsError/invalid-the-Date-error"?: unknown;
4
- }, parentParams: [message?: string | undefined, options?: ErrorOptions | undefined]) => Error & import("../common").Kind<import("../common").KindDefinition<"invalid-the-Date-error", unknown>, unknown> & import("../common").Kind<import("../common").KindDefinition<"@DuplojsUtilsError/invalid-the-Date-error", unknown>, unknown>;
5
- export declare class InvalidTheDateError extends InvalidTheDateError_base {
6
- theDate: TheDate;
7
- constructor(theDate: TheDate);
8
- }
9
2
  export declare function toTimestamp<GenericInput extends TheDate>(input: GenericInput): number;
10
- export {};
@@ -1,28 +1,14 @@
1
- import { theDateRegex } from './constants.mjs';
2
- import { isSafeTimestamp } from './isSafeTimestamp.mjs';
3
- import { kindHeritage } from '../common/kind.mjs';
4
- import { createErrorKind } from '../common/errorKindNamespace.mjs';
1
+ import { theDateRegex, theTimeRegex } from './constants.mjs';
2
+ import { makeSafeTimestamp } from './makeSafeTimestamp.mjs';
5
3
 
6
- class InvalidTheDateError extends kindHeritage("invalid-the-Date-error", createErrorKind("invalid-the-Date-error"), Error) {
7
- theDate;
8
- constructor(theDate) {
9
- super({}, ["TheDate is invalid."]);
10
- this.theDate = theDate;
11
- }
12
- }
13
4
  function toTimestamp(input) {
14
- const match = input.match(theDateRegex);
15
- if (!match) {
16
- throw new InvalidTheDateError(input);
17
- }
5
+ const match = input.startsWith("date")
6
+ ? input.match(theDateRegex)
7
+ : input.match(theTimeRegex);
18
8
  const { value, sign } = match.groups;
19
- const timestamp = Number(sign === "-"
9
+ return makeSafeTimestamp(Number(sign === "-"
20
10
  ? `-${value}`
21
- : value);
22
- if (!isSafeTimestamp(timestamp)) {
23
- throw new InvalidTheDateError(input);
24
- }
25
- return timestamp;
11
+ : value));
26
12
  }
27
13
 
28
- export { InvalidTheDateError, toTimestamp };
14
+ export { toTimestamp };
@@ -1,7 +1,9 @@
1
1
  export * from "./theDate";
2
2
  export * from "./isLeapYear";
3
- export * from "./timezone";
4
3
  export * from "./unit";
5
4
  export * from "./month";
6
5
  export * from "./time";
7
6
  export * from "./isSafeYear";
7
+ export * from "./spoolingDate";
8
+ export * from "./theTime";
9
+ export * from "./spoolingTime";
@@ -1,53 +1,6 @@
1
- import { type Adaptor, type AnyTuple } from "../../common";
2
- import type * as DString from "../../string";
3
- import type * as DArray from "../../array";
1
+ import { type And } from "../../common";
4
2
  import type * as DNumber from "../../number";
5
- interface GreaterTable {
6
- positive: {
7
- greater: [
8
- "3" | "4" | "5" | "6" | "7" | "8" | "9",
9
- "8" | "9",
10
- "6" | "7" | "8" | "9",
11
- "8" | "9",
12
- "6" | "7" | "8" | "9",
13
- ""
14
- ];
15
- equal: [
16
- "2",
17
- "7",
18
- "5",
19
- "7",
20
- "5",
21
- "9"
22
- ];
23
- };
24
- negative: {
25
- greater: [
26
- "3" | "4" | "5" | "6" | "7" | "8" | "9",
27
- "8" | "9",
28
- "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9",
29
- "9",
30
- "3" | "4" | "5" | "6" | "7" | "8" | "9",
31
- "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"
32
- ];
33
- equal: [
34
- "2",
35
- "7",
36
- "1",
37
- "8",
38
- "2",
39
- "0"
40
- ];
41
- };
42
- }
43
- type CheckSplitYear<GenericSplitYear extends AnyTuple<DString.Number>, GenericGreaterTable extends AnyTuple<string>, GenericEqualTable extends AnyTuple<string>> = GenericSplitYear[0] extends GenericGreaterTable[0] ? false : GenericSplitYear[0] extends GenericEqualTable[0] ? [
44
- DArray.ShiftTuple<GenericSplitYear>,
45
- DArray.ShiftTuple<GenericGreaterTable>,
46
- DArray.ShiftTuple<GenericEqualTable>
47
- ] extends [
48
- infer InferredSplitYear extends readonly DString.Number[],
49
- infer InferredGreaterTable extends readonly string[],
50
- infer InferredEqualTable extends readonly string[]
51
- ] ? InferredSplitYear extends AnyTuple<DString.Number> ? CheckSplitYear<InferredSplitYear, Adaptor<InferredGreaterTable, AnyTuple<string>>, Adaptor<InferredEqualTable, AnyTuple<string>>> : true : never : true;
52
- export type IsSafeYear<GenericYears extends number> = DNumber.Absolute<GenericYears> extends infer InferredYear extends number ? DString.StringLength<`${InferredYear}`> extends infer InferredLength extends number ? InferredLength extends 1 | 2 | 3 | 4 | 5 | 6 ? InferredLength extends 6 ? DString.Split<`${InferredYear}`, ""> extends infer InferredSplitYear extends AnyTuple<DString.Number> ? CheckSplitYear<InferredSplitYear, DNumber.IsPositive<GenericYears> extends true ? GreaterTable["positive"]["greater"] : GreaterTable["negative"]["greater"], DNumber.IsPositive<GenericYears> extends true ? GreaterTable["positive"]["equal"] : GreaterTable["negative"]["equal"]> : false : true : false : never : never;
53
- export {};
3
+ export type IsSafeYear<GenericYears extends number> = And<[
4
+ DNumber.IsGreater<GenericYears, -271820>,
5
+ DNumber.IsLess<GenericYears, 275759>
6
+ ]>;
@@ -0,0 +1,12 @@
1
+ import { type Timezone } from "../timezone";
2
+ export interface SpoolingDate {
3
+ value: string | Date | number;
4
+ timezone?: Timezone;
5
+ year?: number;
6
+ month?: number;
7
+ day?: number;
8
+ hour?: number;
9
+ minute?: number;
10
+ second?: number;
11
+ millisecond?: number;
12
+ }
@@ -0,0 +1,9 @@
1
+ export interface SpoolingTime {
2
+ value?: string | number;
3
+ week?: number;
4
+ day?: number;
5
+ hour?: number;
6
+ minute?: number;
7
+ second?: number;
8
+ millisecond?: number;
9
+ }
@@ -0,0 +1 @@
1
+ export type TheTime = `time${number}${"+" | "-"}`;