@elaraai/east 0.0.1-beta.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 (251) hide show
  1. package/LICENSE.md +682 -0
  2. package/README.md +276 -0
  3. package/dist/src/analyze.d.ts +95 -0
  4. package/dist/src/analyze.d.ts.map +1 -0
  5. package/dist/src/analyze.js +1110 -0
  6. package/dist/src/analyze.js.map +1 -0
  7. package/dist/src/ast.d.ts +263 -0
  8. package/dist/src/ast.d.ts.map +1 -0
  9. package/dist/src/ast.js +151 -0
  10. package/dist/src/ast.js.map +1 -0
  11. package/dist/src/ast_to_ir.d.ts +24 -0
  12. package/dist/src/ast_to_ir.d.ts.map +1 -0
  13. package/dist/src/ast_to_ir.js +834 -0
  14. package/dist/src/ast_to_ir.js.map +1 -0
  15. package/dist/src/builtins.d.ts +18 -0
  16. package/dist/src/builtins.d.ts.map +1 -0
  17. package/dist/src/builtins.js +1105 -0
  18. package/dist/src/builtins.js.map +1 -0
  19. package/dist/src/comparison.d.ts +28 -0
  20. package/dist/src/comparison.d.ts.map +1 -0
  21. package/dist/src/comparison.js +1017 -0
  22. package/dist/src/comparison.js.map +1 -0
  23. package/dist/src/compile.d.ts +22 -0
  24. package/dist/src/compile.d.ts.map +1 -0
  25. package/dist/src/compile.js +3260 -0
  26. package/dist/src/compile.js.map +1 -0
  27. package/dist/src/containers/ref.d.ts +106 -0
  28. package/dist/src/containers/ref.d.ts.map +1 -0
  29. package/dist/src/containers/ref.js +100 -0
  30. package/dist/src/containers/ref.js.map +1 -0
  31. package/dist/src/containers/sortedmap.d.ts +165 -0
  32. package/dist/src/containers/sortedmap.d.ts.map +1 -0
  33. package/dist/src/containers/sortedmap.js +237 -0
  34. package/dist/src/containers/sortedmap.js.map +1 -0
  35. package/dist/src/containers/sortedset.d.ts +185 -0
  36. package/dist/src/containers/sortedset.d.ts.map +1 -0
  37. package/dist/src/containers/sortedset.js +312 -0
  38. package/dist/src/containers/sortedset.js.map +1 -0
  39. package/dist/src/containers/variant.d.ts +131 -0
  40. package/dist/src/containers/variant.d.ts.map +1 -0
  41. package/dist/src/containers/variant.js +68 -0
  42. package/dist/src/containers/variant.js.map +1 -0
  43. package/dist/src/datetime_format/parse.d.ts +50 -0
  44. package/dist/src/datetime_format/parse.d.ts.map +1 -0
  45. package/dist/src/datetime_format/parse.js +908 -0
  46. package/dist/src/datetime_format/parse.js.map +1 -0
  47. package/dist/src/datetime_format/print.d.ts +35 -0
  48. package/dist/src/datetime_format/print.d.ts.map +1 -0
  49. package/dist/src/datetime_format/print.js +157 -0
  50. package/dist/src/datetime_format/print.js.map +1 -0
  51. package/dist/src/datetime_format/tokenize.d.ts +76 -0
  52. package/dist/src/datetime_format/tokenize.d.ts.map +1 -0
  53. package/dist/src/datetime_format/tokenize.js +271 -0
  54. package/dist/src/datetime_format/tokenize.js.map +1 -0
  55. package/dist/src/datetime_format/types.d.ts +99 -0
  56. package/dist/src/datetime_format/types.d.ts.map +1 -0
  57. package/dist/src/datetime_format/types.js +103 -0
  58. package/dist/src/datetime_format/types.js.map +1 -0
  59. package/dist/src/datetime_format/validate.d.ts +51 -0
  60. package/dist/src/datetime_format/validate.d.ts.map +1 -0
  61. package/dist/src/datetime_format/validate.js +208 -0
  62. package/dist/src/datetime_format/validate.js.map +1 -0
  63. package/dist/src/default.d.ts +21 -0
  64. package/dist/src/default.d.ts.map +1 -0
  65. package/dist/src/default.js +82 -0
  66. package/dist/src/default.js.map +1 -0
  67. package/dist/src/eastir.d.ts +33 -0
  68. package/dist/src/eastir.d.ts.map +1 -0
  69. package/dist/src/eastir.js +92 -0
  70. package/dist/src/eastir.js.map +1 -0
  71. package/dist/src/error.d.ts +13 -0
  72. package/dist/src/error.d.ts.map +1 -0
  73. package/dist/src/error.js +8 -0
  74. package/dist/src/error.js.map +1 -0
  75. package/dist/src/expr/array.d.ts +1711 -0
  76. package/dist/src/expr/array.d.ts.map +1 -0
  77. package/dist/src/expr/array.js +1805 -0
  78. package/dist/src/expr/array.js.map +1 -0
  79. package/dist/src/expr/ast.d.ts +17 -0
  80. package/dist/src/expr/ast.d.ts.map +1 -0
  81. package/dist/src/expr/ast.js +302 -0
  82. package/dist/src/expr/ast.js.map +1 -0
  83. package/dist/src/expr/blob.d.ts +141 -0
  84. package/dist/src/expr/blob.d.ts.map +1 -0
  85. package/dist/src/expr/blob.js +198 -0
  86. package/dist/src/expr/blob.js.map +1 -0
  87. package/dist/src/expr/block.d.ts +201 -0
  88. package/dist/src/expr/block.d.ts.map +1 -0
  89. package/dist/src/expr/block.js +1505 -0
  90. package/dist/src/expr/block.js.map +1 -0
  91. package/dist/src/expr/boolean.d.ts +207 -0
  92. package/dist/src/expr/boolean.d.ts.map +1 -0
  93. package/dist/src/expr/boolean.js +261 -0
  94. package/dist/src/expr/boolean.js.map +1 -0
  95. package/dist/src/expr/datetime.d.ts +544 -0
  96. package/dist/src/expr/datetime.d.ts.map +1 -0
  97. package/dist/src/expr/datetime.js +980 -0
  98. package/dist/src/expr/datetime.js.map +1 -0
  99. package/dist/src/expr/dict.d.ts +1242 -0
  100. package/dist/src/expr/dict.d.ts.map +1 -0
  101. package/dist/src/expr/dict.js +1492 -0
  102. package/dist/src/expr/dict.js.map +1 -0
  103. package/dist/src/expr/expr.d.ts +95 -0
  104. package/dist/src/expr/expr.d.ts.map +1 -0
  105. package/dist/src/expr/expr.js +171 -0
  106. package/dist/src/expr/expr.js.map +1 -0
  107. package/dist/src/expr/float.d.ts +357 -0
  108. package/dist/src/expr/float.d.ts.map +1 -0
  109. package/dist/src/expr/float.js +637 -0
  110. package/dist/src/expr/float.js.map +1 -0
  111. package/dist/src/expr/function.d.ts +46 -0
  112. package/dist/src/expr/function.d.ts.map +1 -0
  113. package/dist/src/expr/function.js +58 -0
  114. package/dist/src/expr/function.js.map +1 -0
  115. package/dist/src/expr/index.d.ts +450 -0
  116. package/dist/src/expr/index.d.ts.map +1 -0
  117. package/dist/src/expr/index.js +423 -0
  118. package/dist/src/expr/index.js.map +1 -0
  119. package/dist/src/expr/integer.d.ts +256 -0
  120. package/dist/src/expr/integer.d.ts.map +1 -0
  121. package/dist/src/expr/integer.js +311 -0
  122. package/dist/src/expr/integer.js.map +1 -0
  123. package/dist/src/expr/libs/array.d.ts +106 -0
  124. package/dist/src/expr/libs/array.d.ts.map +1 -0
  125. package/dist/src/expr/libs/array.js +140 -0
  126. package/dist/src/expr/libs/array.js.map +1 -0
  127. package/dist/src/expr/libs/blob.d.ts +42 -0
  128. package/dist/src/expr/libs/blob.d.ts.map +1 -0
  129. package/dist/src/expr/libs/blob.js +70 -0
  130. package/dist/src/expr/libs/blob.js.map +1 -0
  131. package/dist/src/expr/libs/datetime.d.ts +479 -0
  132. package/dist/src/expr/libs/datetime.d.ts.map +1 -0
  133. package/dist/src/expr/libs/datetime.js +624 -0
  134. package/dist/src/expr/libs/datetime.js.map +1 -0
  135. package/dist/src/expr/libs/dict.d.ts +66 -0
  136. package/dist/src/expr/libs/dict.d.ts.map +1 -0
  137. package/dist/src/expr/libs/dict.js +77 -0
  138. package/dist/src/expr/libs/dict.js.map +1 -0
  139. package/dist/src/expr/libs/float.d.ts +299 -0
  140. package/dist/src/expr/libs/float.d.ts.map +1 -0
  141. package/dist/src/expr/libs/float.js +564 -0
  142. package/dist/src/expr/libs/float.js.map +1 -0
  143. package/dist/src/expr/libs/integer.d.ts +228 -0
  144. package/dist/src/expr/libs/integer.d.ts.map +1 -0
  145. package/dist/src/expr/libs/integer.js +398 -0
  146. package/dist/src/expr/libs/integer.js.map +1 -0
  147. package/dist/src/expr/libs/set.d.ts +59 -0
  148. package/dist/src/expr/libs/set.d.ts.map +1 -0
  149. package/dist/src/expr/libs/set.js +69 -0
  150. package/dist/src/expr/libs/set.js.map +1 -0
  151. package/dist/src/expr/libs/string.d.ts +71 -0
  152. package/dist/src/expr/libs/string.d.ts.map +1 -0
  153. package/dist/src/expr/libs/string.js +75 -0
  154. package/dist/src/expr/libs/string.js.map +1 -0
  155. package/dist/src/expr/never.d.ts +15 -0
  156. package/dist/src/expr/never.d.ts.map +1 -0
  157. package/dist/src/expr/never.js +12 -0
  158. package/dist/src/expr/never.js.map +1 -0
  159. package/dist/src/expr/null.d.ts +15 -0
  160. package/dist/src/expr/null.d.ts.map +1 -0
  161. package/dist/src/expr/null.js +12 -0
  162. package/dist/src/expr/null.js.map +1 -0
  163. package/dist/src/expr/ref.d.ts +103 -0
  164. package/dist/src/expr/ref.d.ts.map +1 -0
  165. package/dist/src/expr/ref.js +131 -0
  166. package/dist/src/expr/ref.js.map +1 -0
  167. package/dist/src/expr/regex_validation.d.ts +25 -0
  168. package/dist/src/expr/regex_validation.d.ts.map +1 -0
  169. package/dist/src/expr/regex_validation.js +130 -0
  170. package/dist/src/expr/regex_validation.js.map +1 -0
  171. package/dist/src/expr/set.d.ts +1071 -0
  172. package/dist/src/expr/set.d.ts.map +1 -0
  173. package/dist/src/expr/set.js +1137 -0
  174. package/dist/src/expr/set.js.map +1 -0
  175. package/dist/src/expr/string.d.ts +414 -0
  176. package/dist/src/expr/string.d.ts.map +1 -0
  177. package/dist/src/expr/string.js +683 -0
  178. package/dist/src/expr/string.js.map +1 -0
  179. package/dist/src/expr/struct.d.ts +48 -0
  180. package/dist/src/expr/struct.d.ts.map +1 -0
  181. package/dist/src/expr/struct.js +65 -0
  182. package/dist/src/expr/struct.js.map +1 -0
  183. package/dist/src/expr/types.d.ts +68 -0
  184. package/dist/src/expr/types.d.ts.map +1 -0
  185. package/dist/src/expr/types.js +6 -0
  186. package/dist/src/expr/types.js.map +1 -0
  187. package/dist/src/expr/variant.d.ts +137 -0
  188. package/dist/src/expr/variant.d.ts.map +1 -0
  189. package/dist/src/expr/variant.js +105 -0
  190. package/dist/src/expr/variant.js.map +1 -0
  191. package/dist/src/fuzz.d.ts +80 -0
  192. package/dist/src/fuzz.d.ts.map +1 -0
  193. package/dist/src/fuzz.js +300 -0
  194. package/dist/src/fuzz.js.map +1 -0
  195. package/dist/src/index.d.ts +21 -0
  196. package/dist/src/index.d.ts.map +1 -0
  197. package/dist/src/index.js +21 -0
  198. package/dist/src/index.js.map +1 -0
  199. package/dist/src/internal.d.ts +36 -0
  200. package/dist/src/internal.d.ts.map +1 -0
  201. package/dist/src/internal.js +11 -0
  202. package/dist/src/internal.js.map +1 -0
  203. package/dist/src/ir.d.ts +1571 -0
  204. package/dist/src/ir.d.ts.map +1 -0
  205. package/dist/src/ir.js +56 -0
  206. package/dist/src/ir.js.map +1 -0
  207. package/dist/src/location.d.ts +48 -0
  208. package/dist/src/location.d.ts.map +1 -0
  209. package/dist/src/location.js +62 -0
  210. package/dist/src/location.js.map +1 -0
  211. package/dist/src/platform.d.ts +21 -0
  212. package/dist/src/platform.d.ts.map +1 -0
  213. package/dist/src/platform.js +8 -0
  214. package/dist/src/platform.js.map +1 -0
  215. package/dist/src/serialization/beast.d.ts +39 -0
  216. package/dist/src/serialization/beast.d.ts.map +1 -0
  217. package/dist/src/serialization/beast.js +555 -0
  218. package/dist/src/serialization/beast.js.map +1 -0
  219. package/dist/src/serialization/beast2-stream.d.ts +38 -0
  220. package/dist/src/serialization/beast2-stream.d.ts.map +1 -0
  221. package/dist/src/serialization/beast2-stream.js +665 -0
  222. package/dist/src/serialization/beast2-stream.js.map +1 -0
  223. package/dist/src/serialization/beast2.d.ts +41 -0
  224. package/dist/src/serialization/beast2.d.ts.map +1 -0
  225. package/dist/src/serialization/beast2.js +489 -0
  226. package/dist/src/serialization/beast2.js.map +1 -0
  227. package/dist/src/serialization/binary-utils.d.ts +151 -0
  228. package/dist/src/serialization/binary-utils.d.ts.map +1 -0
  229. package/dist/src/serialization/binary-utils.js +929 -0
  230. package/dist/src/serialization/binary-utils.js.map +1 -0
  231. package/dist/src/serialization/east.d.ts +84 -0
  232. package/dist/src/serialization/east.d.ts.map +1 -0
  233. package/dist/src/serialization/east.js +1802 -0
  234. package/dist/src/serialization/east.js.map +1 -0
  235. package/dist/src/serialization/index.d.ts +11 -0
  236. package/dist/src/serialization/index.d.ts.map +1 -0
  237. package/dist/src/serialization/index.js +12 -0
  238. package/dist/src/serialization/index.js.map +1 -0
  239. package/dist/src/serialization/json.d.ts +36 -0
  240. package/dist/src/serialization/json.d.ts.map +1 -0
  241. package/dist/src/serialization/json.js +849 -0
  242. package/dist/src/serialization/json.js.map +1 -0
  243. package/dist/src/type_of_type.d.ts +115 -0
  244. package/dist/src/type_of_type.d.ts.map +1 -0
  245. package/dist/src/type_of_type.js +362 -0
  246. package/dist/src/type_of_type.js.map +1 -0
  247. package/dist/src/types.d.ts +648 -0
  248. package/dist/src/types.d.ts.map +1 -0
  249. package/dist/src/types.js +1631 -0
  250. package/dist/src/types.js.map +1 -0
  251. package/package.json +87 -0
@@ -0,0 +1,624 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+ import { DateTimeType, IntegerType } from "../../types.js";
6
+ import { fromComponents, fromEpochMilliseconds, parseFormatted } from "../datetime.js";
7
+ import { Expr } from "../expr.js";
8
+ /** Standard library functions for datetimes */
9
+ export default {
10
+ /**
11
+ * Creates a DateTime from milliseconds since Unix epoch.
12
+ *
13
+ * @param milliseconds - The number of milliseconds since Unix epoch
14
+ * @returns A DateTime expression representing the specified instant
15
+ *
16
+ * @remarks
17
+ * Similar to JavaScript's `new Date(ms)`, this function converts a timestamp
18
+ * (milliseconds since January 1, 1970 00:00:00 UTC) into an East DateTime.
19
+ *
20
+ * @example
21
+ * ```ts
22
+ * const fromEpoch = East.function([IntegerType], DateTimeType, ($, ms) => {
23
+ * $.return(East.DateTime.fromEpochMilliseconds(ms));
24
+ * });
25
+ * const compiled = East.compile(fromEpoch.toIR(), []);
26
+ * compiled(0n); // 1970-01-01T00:00:00.000Z
27
+ * compiled(1609459200000n); // 2021-01-01T00:00:00.000Z
28
+ * ```
29
+ */
30
+ fromEpochMilliseconds,
31
+ /**
32
+ * Creates a DateTime from individual date and time components.
33
+ *
34
+ * @param year - The year component
35
+ * @param month - The month component (1-12, default: 1)
36
+ * @param day - The day component (1-31, default: 1)
37
+ * @param hour - The hour component (0-23, default: 0)
38
+ * @param minute - The minute component (0-59, default: 0)
39
+ * @param second - The second component (0-59, default: 0)
40
+ * @param millisecond - The millisecond component (0-999, default: 0)
41
+ * @returns A DateTime expression representing the specified instant
42
+ *
43
+ * @remarks
44
+ * Components are: year, month (1-12), day (1-31), hour (0-23), minute (0-59),
45
+ * second (0-59), and millisecond (0-999).
46
+ *
47
+ * @example
48
+ * ```ts
49
+ * const makeDate = East.function([IntegerType], DateTimeType, ($, year) => {
50
+ * $.return(East.DateTime.fromComponents(year, 1n, 15n));
51
+ * });
52
+ * const compiled = East.compile(makeDate.toIR(), []);
53
+ * compiled(2025n); // 2025-01-15T00:00:00.000Z
54
+ * ```
55
+ *
56
+ * @example
57
+ * ```ts
58
+ * const makeDateTime = East.function([], DateTimeType, ($) => {
59
+ * $.return(East.DateTime.fromComponents(2025n, 1n, 15n, 14n, 30n, 0n, 500n));
60
+ * });
61
+ * const compiled = East.compile(makeDateTime.toIR(), []);
62
+ * compiled(); // 2025-01-15T14:30:00.500Z
63
+ * ```
64
+ */
65
+ fromComponents,
66
+ /**
67
+ * Parses a formatted string into a DateTime using Day.js-style format tokens.
68
+ *
69
+ * @param input - The string to parse
70
+ * @param format - The format string using Day.js-style tokens (e.g., `"YYYY-MM-DD HH:mm:ss"`)
71
+ * @returns A DateTime expression representing the parsed instant
72
+ *
73
+ * @remarks
74
+ * The format string is parsed at compile time into structured tokens.
75
+ * Use backslash to escape characters: `\Y` produces literal "Y".
76
+ * All parsing is done in UTC (naive datetime).
77
+ *
78
+ * Supported tokens:
79
+ * - Year: YYYY (4-digit), YY (2-digit, 00-99 → 2000-2099)
80
+ * - Month: M (1-12), MM (01-12), MMM (Jan), MMMM (January) - case insensitive
81
+ * - Day: D (1-31), DD (01-31)
82
+ * - Weekday: dd (Su), ddd (Sun), dddd (Sunday) - consumed but not validated
83
+ * - Hour 24h: H (0-23), HH (00-23)
84
+ * - Hour 12h: h (1-12), hh (01-12) - requires A/a token
85
+ * - Minute: m (0-59), mm (00-59)
86
+ * - Second: s (0-59), ss (00-59)
87
+ * - Millisecond: SSS (000-999)
88
+ * - AM/PM: A (AM/PM), a (am/pm) - case insensitive
89
+ *
90
+ * @example
91
+ * ```ts
92
+ * const parseDate = East.function([StringType], DateTimeType, ($, dateStr) => {
93
+ * $.return(East.DateTime.parseFormatted(dateStr, "YYYY-MM-DD"));
94
+ * });
95
+ * const compiled = East.compile(parseDate.toIR(), []);
96
+ * compiled("2025-01-15"); // 2025-01-15T00:00:00.000Z
97
+ * ```
98
+ *
99
+ * @example
100
+ * ```ts
101
+ * const parseDateTime = East.function([StringType], DateTimeType, ($, str) => {
102
+ * $.return(East.DateTime.parseFormatted(str, "MM/DD/YYYY HH:mm"));
103
+ * });
104
+ * const compiled = East.compile(parseDateTime.toIR(), []);
105
+ * compiled("01/15/2025 14:30"); // 2025-01-15T14:30:00.000Z
106
+ * ```
107
+ */
108
+ parseFormatted,
109
+ /**
110
+ * Rounds a DateTime down to the nearest multiple of milliseconds.
111
+ *
112
+ * @param date - The DateTime to round
113
+ * @param step - The millisecond step size to round to
114
+ * @returns A DateTime expression rounded down to the nearest multiple of the step
115
+ *
116
+ * @example
117
+ * ```ts
118
+ * const roundMs = East.function([DateTimeType, IntegerType], DateTimeType, ($, dt, step) => {
119
+ * $.return(East.DateTime.roundDownMillisecond(dt, step));
120
+ * });
121
+ * const compiled = East.compile(roundMs.toIR(), []);
122
+ * // Round down to nearest 100ms
123
+ * compiled(East.DateTime.fromEpochMilliseconds(1234n), 100n); // Rounded to 1200ms
124
+ * ```
125
+ */
126
+ roundDownMillisecond: Expr.function([DateTimeType, IntegerType], DateTimeType, ($, date, step) => {
127
+ const epochMs = $.let(date.toEpochMilliseconds());
128
+ const remainder = $.let(epochMs.remainder(step));
129
+ const roundedMs = $.let(epochMs.subtract(remainder));
130
+ return fromEpochMilliseconds(roundedMs);
131
+ }),
132
+ /**
133
+ * Rounds a DateTime down to the nearest multiple of seconds.
134
+ *
135
+ * @param date - The DateTime to round
136
+ * @param step - The second step size to round to
137
+ * @returns A DateTime expression rounded down to the nearest multiple of the step
138
+ *
139
+ * @example
140
+ * ```ts
141
+ * const roundSec = East.function([DateTimeType, IntegerType], DateTimeType, ($, dt, step) => {
142
+ * $.return(East.DateTime.roundDownSecond(dt, step));
143
+ * });
144
+ * const compiled = East.compile(roundSec.toIR(), []);
145
+ * // Round down to nearest 30 seconds
146
+ * compiled(East.DateTime.fromComponents(2025n, 1n, 1n, 0n, 0n, 45n), 30n); // Rounds to 30s
147
+ * ```
148
+ */
149
+ roundDownSecond: Expr.function([DateTimeType, IntegerType], DateTimeType, ($, date, step) => {
150
+ const epochMs = $.let(date.toEpochMilliseconds());
151
+ const stepMs = $.let(step.multiply(1000n));
152
+ const remainder = $.let(epochMs.remainder(stepMs));
153
+ const roundedMs = $.let(epochMs.subtract(remainder));
154
+ return fromEpochMilliseconds(roundedMs);
155
+ }),
156
+ /**
157
+ * Rounds a DateTime down to the nearest multiple of minutes.
158
+ *
159
+ * @param date - The DateTime to round
160
+ * @param step - The minute step size to round to
161
+ * @returns A DateTime expression rounded down to the nearest multiple of the step
162
+ *
163
+ * @example
164
+ * ```ts
165
+ * const roundMin = East.function([DateTimeType, IntegerType], DateTimeType, ($, dt, step) => {
166
+ * $.return(East.DateTime.roundDownMinute(dt, step));
167
+ * });
168
+ * const compiled = East.compile(roundMin.toIR(), []);
169
+ * // Round down to nearest 15 minutes
170
+ * compiled(East.DateTime.fromComponents(2025n, 1n, 1n, 0n, 22n), 15n); // Rounds to 15 min
171
+ * ```
172
+ */
173
+ roundDownMinute: Expr.function([DateTimeType, IntegerType], DateTimeType, ($, date, step) => {
174
+ const epochMs = $.let(date.toEpochMilliseconds());
175
+ const stepMs = $.let(step.multiply(60000n));
176
+ const remainder = $.let(epochMs.remainder(stepMs));
177
+ const roundedMs = $.let(epochMs.subtract(remainder));
178
+ return fromEpochMilliseconds(roundedMs);
179
+ }),
180
+ /**
181
+ * Rounds a DateTime down to the nearest multiple of hours.
182
+ *
183
+ * @param date - The DateTime to round
184
+ * @param step - The hour step size to round to
185
+ * @returns A DateTime expression rounded down to the nearest multiple of the step
186
+ *
187
+ * @example
188
+ * ```ts
189
+ * const roundHour = East.function([DateTimeType, IntegerType], DateTimeType, ($, dt, step) => {
190
+ * $.return(East.DateTime.roundDownHour(dt, step));
191
+ * });
192
+ * const compiled = East.compile(roundHour.toIR(), []);
193
+ * // Round down to nearest 6 hours
194
+ * compiled(East.DateTime.fromComponents(2025n, 1n, 1n, 8n), 6n); // Rounds to 6:00
195
+ * ```
196
+ */
197
+ roundDownHour: Expr.function([DateTimeType, IntegerType], DateTimeType, ($, date, step) => {
198
+ const epochMs = $.let(date.toEpochMilliseconds());
199
+ const stepMs = $.let(step.multiply(3600000n));
200
+ const remainder = $.let(epochMs.remainder(stepMs));
201
+ const roundedMs = $.let(epochMs.subtract(remainder));
202
+ return fromEpochMilliseconds(roundedMs);
203
+ }),
204
+ /**
205
+ * Rounds a DateTime up to the nearest multiple of milliseconds.
206
+ *
207
+ * @param date - The DateTime to round
208
+ * @param step - The millisecond step size to round to
209
+ * @returns A DateTime expression rounded up to the nearest multiple of the step
210
+ *
211
+ * @example
212
+ * ```ts
213
+ * const roundUpMs = East.function([DateTimeType, IntegerType], DateTimeType, ($, dt, step) => {
214
+ * $.return(East.DateTime.roundUpMillisecond(dt, step));
215
+ * });
216
+ * const compiled = East.compile(roundUpMs.toIR(), []);
217
+ * // Round up to nearest 100ms
218
+ * compiled(East.DateTime.fromEpochMilliseconds(1234n), 100n); // Rounds to 1300ms
219
+ * ```
220
+ */
221
+ roundUpMillisecond: Expr.function([DateTimeType, IntegerType], DateTimeType, ($, date, step) => {
222
+ const epochMs = $.let(date.toEpochMilliseconds());
223
+ const remainder = $.let(epochMs.remainder(step));
224
+ const roundedMs = $.let(Expr.equal(remainder, 0n).ifElse(() => epochMs, () => epochMs.add(step.subtract(remainder))));
225
+ return fromEpochMilliseconds(roundedMs);
226
+ }),
227
+ /**
228
+ * Rounds a DateTime to the nearest multiple of milliseconds.
229
+ *
230
+ * @param date - The DateTime to round
231
+ * @param step - The millisecond step size to round to
232
+ * @returns A DateTime expression rounded to the nearest multiple of the step
233
+ *
234
+ * @example
235
+ * ```ts
236
+ * const roundNearMs = East.function([DateTimeType, IntegerType], DateTimeType, ($, dt, step) => {
237
+ * $.return(East.DateTime.roundNearestMillisecond(dt, step));
238
+ * });
239
+ * const compiled = East.compile(roundNearMs.toIR(), []);
240
+ * // Round to nearest 100ms
241
+ * compiled(East.DateTime.fromEpochMilliseconds(1234n), 100n); // Rounds to 1200ms
242
+ * compiled(East.DateTime.fromEpochMilliseconds(1289n), 100n); // Rounds to 1300ms
243
+ * ```
244
+ */
245
+ roundNearestMillisecond: Expr.function([DateTimeType, IntegerType], DateTimeType, ($, date, step) => {
246
+ const epochMs = $.let(date.toEpochMilliseconds());
247
+ const remainder = $.let(epochMs.remainder(step));
248
+ const halfStep = $.let(step.divide(2n));
249
+ const roundedMs = $.let(Expr.equal(remainder, 0n).ifElse(() => epochMs, () => Expr.greaterEqual(remainder, halfStep).ifElse(() => epochMs.add(step.subtract(remainder)), () => epochMs.subtract(remainder))));
250
+ return fromEpochMilliseconds(roundedMs);
251
+ }),
252
+ /**
253
+ * Rounds a DateTime up to the nearest multiple of seconds.
254
+ *
255
+ * @param date - The DateTime to round
256
+ * @param step - The second step size to round to
257
+ * @returns A DateTime expression rounded up to the nearest multiple of the step
258
+ *
259
+ * @example
260
+ * ```ts
261
+ * const roundUpSec = East.function([DateTimeType, IntegerType], DateTimeType, ($, dt, step) => {
262
+ * $.return(East.DateTime.roundUpSecond(dt, step));
263
+ * });
264
+ * const compiled = East.compile(roundUpSec.toIR(), []);
265
+ * // Round up to nearest 30 seconds
266
+ * compiled(East.DateTime.fromComponents(2025n, 1n, 1n, 0n, 0n, 15n), 30n); // Rounds to 30s
267
+ * ```
268
+ */
269
+ roundUpSecond: Expr.function([DateTimeType, IntegerType], DateTimeType, ($, date, step) => {
270
+ const epochMs = $.let(date.toEpochMilliseconds());
271
+ const stepMs = $.let(step.multiply(1000n));
272
+ const remainder = $.let(epochMs.remainder(stepMs));
273
+ const roundedMs = $.let(Expr.equal(remainder, 0n).ifElse(() => epochMs, () => epochMs.add(stepMs.subtract(remainder))));
274
+ return fromEpochMilliseconds(roundedMs);
275
+ }),
276
+ /**
277
+ * Rounds a DateTime to the nearest multiple of seconds.
278
+ *
279
+ * @param date - The DateTime to round
280
+ * @param step - The second step size to round to
281
+ * @returns A DateTime expression rounded to the nearest multiple of the step
282
+ *
283
+ * @example
284
+ * ```ts
285
+ * const roundNearSec = East.function([DateTimeType, IntegerType], DateTimeType, ($, dt, step) => {
286
+ * $.return(East.DateTime.roundNearestSecond(dt, step));
287
+ * });
288
+ * const compiled = East.compile(roundNearSec.toIR(), []);
289
+ * // Round to nearest 30 seconds
290
+ * compiled(East.DateTime.fromComponents(2025n, 1n, 1n, 0n, 0n, 22n), 30n); // Rounds to 30s
291
+ * compiled(East.DateTime.fromComponents(2025n, 1n, 1n, 0n, 0n, 38n), 30n); // Rounds to 30s
292
+ * ```
293
+ */
294
+ roundNearestSecond: Expr.function([DateTimeType, IntegerType], DateTimeType, ($, date, step) => {
295
+ const epochMs = $.let(date.toEpochMilliseconds());
296
+ const stepMs = $.let(step.multiply(1000n));
297
+ const remainder = $.let(epochMs.remainder(stepMs));
298
+ const halfStep = $.let(stepMs.divide(2n));
299
+ const roundedMs = $.let(Expr.equal(remainder, 0n).ifElse(() => epochMs, () => Expr.greaterEqual(remainder, halfStep).ifElse(() => epochMs.add(stepMs.subtract(remainder)), () => epochMs.subtract(remainder))));
300
+ return fromEpochMilliseconds(roundedMs);
301
+ }),
302
+ /**
303
+ * Rounds a DateTime up to the nearest multiple of minutes.
304
+ *
305
+ * @param date - The DateTime to round
306
+ * @param step - The minute step size to round to
307
+ * @returns A DateTime expression rounded up to the nearest multiple of the step
308
+ *
309
+ * @example
310
+ * ```ts
311
+ * const roundUpMin = East.function([DateTimeType, IntegerType], DateTimeType, ($, dt, step) => {
312
+ * $.return(East.DateTime.roundUpMinute(dt, step));
313
+ * });
314
+ * const compiled = East.compile(roundUpMin.toIR(), []);
315
+ * // Round up to nearest 15 minutes
316
+ * compiled(East.DateTime.fromComponents(2025n, 1n, 1n, 0n, 22n), 15n); // Rounds to 30 min
317
+ * ```
318
+ */
319
+ roundUpMinute: Expr.function([DateTimeType, IntegerType], DateTimeType, ($, date, step) => {
320
+ const epochMs = $.let(date.toEpochMilliseconds());
321
+ const stepMs = $.let(step.multiply(60000n));
322
+ const remainder = $.let(epochMs.remainder(stepMs));
323
+ const roundedMs = $.let(Expr.equal(remainder, 0n).ifElse(() => epochMs, () => epochMs.add(stepMs.subtract(remainder))));
324
+ return fromEpochMilliseconds(roundedMs);
325
+ }),
326
+ /**
327
+ * Rounds a DateTime to the nearest multiple of minutes.
328
+ *
329
+ * @param date - The DateTime to round
330
+ * @param step - The minute step size to round to
331
+ * @returns A DateTime expression rounded to the nearest multiple of the step
332
+ *
333
+ * @example
334
+ * ```ts
335
+ * const roundNearMin = East.function([DateTimeType, IntegerType], DateTimeType, ($, dt, step) => {
336
+ * $.return(East.DateTime.roundNearestMinute(dt, step));
337
+ * });
338
+ * const compiled = East.compile(roundNearMin.toIR(), []);
339
+ * // Round to nearest 15 minutes
340
+ * compiled(East.DateTime.fromComponents(2025n, 1n, 1n, 0n, 22n), 15n); // Rounds to 15 min
341
+ * compiled(East.DateTime.fromComponents(2025n, 1n, 1n, 0n, 38n), 15n); // Rounds to 45 min
342
+ * ```
343
+ */
344
+ roundNearestMinute: Expr.function([DateTimeType, IntegerType], DateTimeType, ($, date, step) => {
345
+ const epochMs = $.let(date.toEpochMilliseconds());
346
+ const stepMs = $.let(step.multiply(60000n));
347
+ const remainder = $.let(epochMs.remainder(stepMs));
348
+ const halfStep = $.let(stepMs.divide(2n));
349
+ const roundedMs = $.let(Expr.equal(remainder, 0n).ifElse(() => epochMs, () => Expr.greaterEqual(remainder, halfStep).ifElse(() => epochMs.add(stepMs.subtract(remainder)), () => epochMs.subtract(remainder))));
350
+ return fromEpochMilliseconds(roundedMs);
351
+ }),
352
+ /**
353
+ * Rounds a DateTime up to the nearest multiple of hours.
354
+ *
355
+ * @param date - The DateTime to round
356
+ * @param step - The hour step size to round to
357
+ * @returns A DateTime expression rounded up to the nearest multiple of the step
358
+ *
359
+ * @example
360
+ * ```ts
361
+ * const roundUpHr = East.function([DateTimeType, IntegerType], DateTimeType, ($, dt, step) => {
362
+ * $.return(East.DateTime.roundUpHour(dt, step));
363
+ * });
364
+ * const compiled = East.compile(roundUpHr.toIR(), []);
365
+ * // Round up to nearest 6 hours
366
+ * compiled(East.DateTime.fromComponents(2025n, 1n, 1n, 8n), 6n); // Rounds to 12:00
367
+ * ```
368
+ */
369
+ roundUpHour: Expr.function([DateTimeType, IntegerType], DateTimeType, ($, date, step) => {
370
+ const epochMs = $.let(date.toEpochMilliseconds());
371
+ const stepMs = $.let(step.multiply(3600000n));
372
+ const remainder = $.let(epochMs.remainder(stepMs));
373
+ const roundedMs = $.let(Expr.equal(remainder, 0n).ifElse(() => epochMs, () => epochMs.add(stepMs.subtract(remainder))));
374
+ return fromEpochMilliseconds(roundedMs);
375
+ }),
376
+ /**
377
+ * Rounds a DateTime to the nearest multiple of hours.
378
+ *
379
+ * @param date - The DateTime to round
380
+ * @param step - The hour step size to round to
381
+ * @returns A DateTime expression rounded to the nearest multiple of the step
382
+ *
383
+ * @example
384
+ * ```ts
385
+ * const roundNearHr = East.function([DateTimeType, IntegerType], DateTimeType, ($, dt, step) => {
386
+ * $.return(East.DateTime.roundNearestHour(dt, step));
387
+ * });
388
+ * const compiled = East.compile(roundNearHr.toIR(), []);
389
+ * // Round to nearest 6 hours
390
+ * compiled(East.DateTime.fromComponents(2025n, 1n, 1n, 8n), 6n); // Rounds to 6:00
391
+ * compiled(East.DateTime.fromComponents(2025n, 1n, 1n, 10n), 6n); // Rounds to 12:00
392
+ * ```
393
+ */
394
+ roundNearestHour: Expr.function([DateTimeType, IntegerType], DateTimeType, ($, date, step) => {
395
+ const epochMs = $.let(date.toEpochMilliseconds());
396
+ const stepMs = $.let(step.multiply(3600000n));
397
+ const remainder = $.let(epochMs.remainder(stepMs));
398
+ const halfStep = $.let(stepMs.divide(2n));
399
+ const roundedMs = $.let(Expr.equal(remainder, 0n).ifElse(() => epochMs, () => Expr.greaterEqual(remainder, halfStep).ifElse(() => epochMs.add(stepMs.subtract(remainder)), () => epochMs.subtract(remainder))));
400
+ return fromEpochMilliseconds(roundedMs);
401
+ }),
402
+ /**
403
+ * Rounds a DateTime down to the nearest multiple of days.
404
+ *
405
+ * @param date - The DateTime to round
406
+ * @param step - The day step size to round to
407
+ * @returns A DateTime expression rounded down to the nearest multiple of the step
408
+ *
409
+ * @example
410
+ * ```ts
411
+ * const roundDownD = East.function([DateTimeType, IntegerType], DateTimeType, ($, dt, step) => {
412
+ * $.return(East.DateTime.roundDownDay(dt, step));
413
+ * });
414
+ * const compiled = East.compile(roundDownD.toIR(), []);
415
+ * // Round down to nearest day
416
+ * compiled(East.DateTime.fromComponents(2025n, 1n, 1n, 12n, 30n), 1n); // Rounds to start of day
417
+ * ```
418
+ */
419
+ roundDownDay: Expr.function([DateTimeType, IntegerType], DateTimeType, ($, date, step) => {
420
+ const epochMs = $.let(date.toEpochMilliseconds());
421
+ // Convert step from days to milliseconds (step * 24 * 60 * 60 * 1000)
422
+ const stepMs = $.let(step.multiply(86400000n));
423
+ const remainder = $.let(epochMs.remainder(stepMs));
424
+ const roundedMs = $.let(epochMs.subtract(remainder));
425
+ return fromEpochMilliseconds(roundedMs);
426
+ }),
427
+ /**
428
+ * Rounds a DateTime up to the nearest multiple of days.
429
+ *
430
+ * @param date - The DateTime to round
431
+ * @param step - The day step size to round to
432
+ * @returns A DateTime expression rounded up to the nearest multiple of the step
433
+ *
434
+ * @example
435
+ * ```ts
436
+ * const roundUpD = East.function([DateTimeType, IntegerType], DateTimeType, ($, dt, step) => {
437
+ * $.return(East.DateTime.roundUpDay(dt, step));
438
+ * });
439
+ * const compiled = East.compile(roundUpD.toIR(), []);
440
+ * // Round up to nearest day
441
+ * compiled(East.DateTime.fromComponents(2025n, 1n, 1n, 12n, 30n), 1n); // Rounds to next day start
442
+ * ```
443
+ */
444
+ roundUpDay: Expr.function([DateTimeType, IntegerType], DateTimeType, ($, date, step) => {
445
+ const epochMs = $.let(date.toEpochMilliseconds());
446
+ const stepMs = $.let(step.multiply(86400000n));
447
+ const remainder = $.let(epochMs.remainder(stepMs));
448
+ const roundedMs = $.let(Expr.equal(remainder, 0n).ifElse(() => epochMs, () => epochMs.add(stepMs.subtract(remainder))));
449
+ return fromEpochMilliseconds(roundedMs);
450
+ }),
451
+ /**
452
+ * Rounds a DateTime to the nearest multiple of days.
453
+ *
454
+ * @param date - The DateTime to round
455
+ * @param step - The day step size to round to
456
+ * @returns A DateTime expression rounded to the nearest multiple of the step
457
+ *
458
+ * @example
459
+ * ```ts
460
+ * const roundNearD = East.function([DateTimeType, IntegerType], DateTimeType, ($, dt, step) => {
461
+ * $.return(East.DateTime.roundNearestDay(dt, step));
462
+ * });
463
+ * const compiled = East.compile(roundNearD.toIR(), []);
464
+ * // Round to nearest day
465
+ * compiled(East.DateTime.fromComponents(2025n, 1n, 1n, 8n), 1n); // Rounds to start of day
466
+ * compiled(East.DateTime.fromComponents(2025n, 1n, 1n, 16n), 1n); // Rounds to next day start
467
+ * ```
468
+ */
469
+ roundNearestDay: Expr.function([DateTimeType, IntegerType], DateTimeType, ($, date, step) => {
470
+ const epochMs = $.let(date.toEpochMilliseconds());
471
+ const stepMs = $.let(step.multiply(86400000n));
472
+ const remainder = $.let(epochMs.remainder(stepMs));
473
+ const halfStep = $.let(stepMs.divide(2n));
474
+ const roundedMs = $.let(Expr.equal(remainder, 0n).ifElse(() => epochMs, () => Expr.greaterEqual(remainder, halfStep).ifElse(() => epochMs.add(stepMs.subtract(remainder)), () => epochMs.subtract(remainder))));
475
+ return fromEpochMilliseconds(roundedMs);
476
+ }),
477
+ /**
478
+ * Rounds a DateTime down to the nearest Monday (ISO week start).
479
+ *
480
+ * @param date - The DateTime to round
481
+ * @param step - The week step size to round to
482
+ * @returns A DateTime expression rounded down to the nearest multiple of weeks (starting on Monday)
483
+ *
484
+ * @example
485
+ * ```ts
486
+ * const roundDownWk = East.function([DateTimeType, IntegerType], DateTimeType, ($, dt, step) => {
487
+ * $.return(East.DateTime.roundDownWeek(dt, step));
488
+ * });
489
+ * const compiled = East.compile(roundDownWk.toIR(), []);
490
+ * // Round down to nearest Monday
491
+ * compiled(East.DateTime.fromComponents(2025n, 1n, 3n), 1n); // Rounds to previous Monday
492
+ * ```
493
+ */
494
+ roundDownWeek: Expr.function([DateTimeType, IntegerType], DateTimeType, ($, date, step) => {
495
+ const epochMs = $.let(date.toEpochMilliseconds());
496
+ // Reference Monday: 1969-12-29T00:00:00.000Z (Monday before Unix epoch)
497
+ const refMondayMs = $.let(-259200000n); // 3 days before epoch in milliseconds
498
+ // Calculate offset from reference Monday and apply step-based rounding
499
+ const offsetFromRefMonday = $.let(epochMs.subtract(refMondayMs));
500
+ const stepMs = $.let(step.multiply(604800000n)); // 7 days in milliseconds
501
+ const remainder = $.let(offsetFromRefMonday.remainder(stepMs));
502
+ const roundedOffsetFromRef = $.let(offsetFromRefMonday.subtract(remainder));
503
+ // Calculate result relative to reference Monday
504
+ const roundedMs = $.let(refMondayMs.add(roundedOffsetFromRef));
505
+ return fromEpochMilliseconds(roundedMs);
506
+ }),
507
+ /**
508
+ * Rounds a DateTime up to the nearest Monday (ISO week start).
509
+ *
510
+ * @param date - The DateTime to round
511
+ * @param step - The week step size to round to
512
+ * @returns A DateTime expression rounded up to the nearest multiple of weeks (starting on Monday)
513
+ *
514
+ * @example
515
+ * ```ts
516
+ * const roundUpWk = East.function([DateTimeType, IntegerType], DateTimeType, ($, dt, step) => {
517
+ * $.return(East.DateTime.roundUpWeek(dt, step));
518
+ * });
519
+ * const compiled = East.compile(roundUpWk.toIR(), []);
520
+ * // Round up to nearest Monday
521
+ * compiled(East.DateTime.fromComponents(2025n, 1n, 3n), 1n); // Rounds to next Monday
522
+ * ```
523
+ */
524
+ roundUpWeek: Expr.function([DateTimeType, IntegerType], DateTimeType, ($, date, step) => {
525
+ const epochMs = $.let(date.toEpochMilliseconds());
526
+ // Reference Monday: 1969-12-29T00:00:00.000Z (Monday before Unix epoch)
527
+ const refMondayMs = $.let(-259200000n);
528
+ // Calculate offset from reference Monday and apply step-based rounding
529
+ const offsetFromRefMonday = $.let(epochMs.subtract(refMondayMs));
530
+ const stepMs = $.let(step.multiply(604800000n));
531
+ const remainder = $.let(offsetFromRefMonday.remainder(stepMs));
532
+ const roundedOffsetFromRef = $.let(Expr.equal(remainder, 0n).ifElse(() => offsetFromRefMonday, () => offsetFromRefMonday.add(stepMs.subtract(remainder))));
533
+ // Calculate result relative to reference Monday
534
+ const roundedMs = $.let(refMondayMs.add(roundedOffsetFromRef));
535
+ return fromEpochMilliseconds(roundedMs);
536
+ }),
537
+ /**
538
+ * Rounds a DateTime to the nearest Monday (ISO week start).
539
+ *
540
+ * @param date - The DateTime to round
541
+ * @param step - The week step size to round to
542
+ * @returns A DateTime expression rounded to the nearest multiple of weeks (starting on Monday)
543
+ *
544
+ * @example
545
+ * ```ts
546
+ * const roundNearWk = East.function([DateTimeType, IntegerType], DateTimeType, ($, dt, step) => {
547
+ * $.return(East.DateTime.roundNearestWeek(dt, step));
548
+ * });
549
+ * const compiled = East.compile(roundNearWk.toIR(), []);
550
+ * // Round to nearest Monday
551
+ * compiled(East.DateTime.fromComponents(2025n, 1n, 3n), 1n); // Rounds to closest Monday
552
+ * ```
553
+ */
554
+ roundNearestWeek: Expr.function([DateTimeType, IntegerType], DateTimeType, ($, date, step) => {
555
+ const epochMs = $.let(date.toEpochMilliseconds());
556
+ // Reference Monday: 1969-12-29T00:00:00.000Z (Monday before Unix epoch)
557
+ const refMondayMs = $.let(-259200000n);
558
+ // Calculate offset from reference Monday and apply step-based rounding
559
+ const offsetFromRefMonday = $.let(epochMs.subtract(refMondayMs));
560
+ const stepMs = $.let(step.multiply(604800000n));
561
+ const remainder = $.let(offsetFromRefMonday.remainder(stepMs));
562
+ const halfStep = $.let(stepMs.divide(2n));
563
+ const roundedOffsetFromRef = $.let(Expr.equal(remainder, 0n).ifElse(() => offsetFromRefMonday, () => Expr.greaterEqual(remainder, halfStep).ifElse(() => offsetFromRefMonday.add(stepMs.subtract(remainder)), () => offsetFromRefMonday.subtract(remainder))));
564
+ // Calculate result relative to reference Monday
565
+ const roundedMs = $.let(refMondayMs.add(roundedOffsetFromRef));
566
+ return fromEpochMilliseconds(roundedMs);
567
+ }),
568
+ /**
569
+ * Rounds a DateTime down to the nearest month boundary.
570
+ *
571
+ * @param date - The DateTime to round
572
+ * @param step - The month step size to round to
573
+ * @returns A DateTime expression rounded down to the first day of the nearest multiple of months
574
+ *
575
+ * @example
576
+ * ```ts
577
+ * const roundDownMo = East.function([DateTimeType, IntegerType], DateTimeType, ($, dt, step) => {
578
+ * $.return(East.DateTime.roundDownMonth(dt, step));
579
+ * });
580
+ * const compiled = East.compile(roundDownMo.toIR(), []);
581
+ * // Round down to nearest month (first day of the month at midnight)
582
+ * compiled(East.DateTime.fromComponents(2025n, 1n, 15n), 1n); // Rounds to Jan 1, 2025
583
+ * // Round down to nearest quarter (Jan 1, Apr 1, Jul 1, Oct 1)
584
+ * compiled(East.DateTime.fromComponents(2025n, 5n, 15n), 3n); // Rounds to Apr 1, 2025
585
+ * ```
586
+ */
587
+ roundDownMonth: Expr.function([DateTimeType, IntegerType], DateTimeType, ($, date, step) => {
588
+ const year = $.let(date.getYear());
589
+ const month = $.let(date.getMonth());
590
+ // Calculate step-aligned month: floor((month - 1) / step) * step + 1
591
+ const monthIndex = $.let(month.subtract(1n)); // Convert to 0-based
592
+ const steppedMonthIndex = $.let(monthIndex.subtract(monthIndex.remainder(step)));
593
+ const roundedMonth = $.let(steppedMonthIndex.add(1n)); // Convert back to 1-based
594
+ // Construct DateTime from components (1st day of month, midnight)
595
+ return fromComponents(year, roundedMonth);
596
+ }),
597
+ /**
598
+ * Rounds a DateTime down to the nearest year boundary.
599
+ *
600
+ * @param date - The DateTime to round
601
+ * @param step - The year step size to round to
602
+ * @returns A DateTime expression rounded down to January 1st of the nearest multiple of years
603
+ *
604
+ * @example
605
+ * ```ts
606
+ * const roundDownYr = East.function([DateTimeType, IntegerType], DateTimeType, ($, dt, step) => {
607
+ * $.return(East.DateTime.roundDownYear(dt, step));
608
+ * });
609
+ * const compiled = East.compile(roundDownYr.toIR(), []);
610
+ * // Round down to nearest year (January 1st at midnight)
611
+ * compiled(East.DateTime.fromComponents(2025n, 6n, 15n), 1n); // Rounds to Jan 1, 2025
612
+ * // Round down to nearest decade
613
+ * compiled(East.DateTime.fromComponents(2025n, 6n, 15n), 10n); // Rounds to Jan 1, 2020
614
+ * ```
615
+ */
616
+ roundDownYear: Expr.function([DateTimeType, IntegerType], DateTimeType, ($, date, step) => {
617
+ const year = $.let(date.getYear());
618
+ // Calculate step-aligned year: floor(year / step) * step
619
+ const steppedYear = $.let(year.subtract(year.remainder(step)));
620
+ // Construct DateTime from components (January 1st, midnight)
621
+ return fromComponents(steppedYear);
622
+ }),
623
+ };
624
+ //# sourceMappingURL=datetime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"datetime.js","sourceRoot":"","sources":["../../../../src/expr/libs/datetime.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACvF,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAElC,+CAA+C;AAC/C,eAAe;IACb;;;;;;;;;;;;;;;;;;;OAmBG;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