@powerlines/plugin-date 0.12.67 → 0.12.69

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 (184) hide show
  1. package/dist/_virtual/rolldown_runtime.cjs +1 -0
  2. package/dist/{chunk-BGGBqwuQ.mjs → _virtual/rolldown_runtime.mjs} +1 -1
  3. package/dist/alloy/src/core/components/output.cjs +1 -0
  4. package/dist/alloy/src/core/components/output.mjs +1 -0
  5. package/dist/alloy/src/core/components/single-line-comment.cjs +1 -0
  6. package/dist/alloy/src/core/components/single-line-comment.mjs +1 -0
  7. package/dist/alloy/src/core/components/source-file.cjs +1 -0
  8. package/dist/alloy/src/core/components/source-file.mjs +1 -0
  9. package/dist/alloy/src/core/contexts/context.cjs +1 -0
  10. package/dist/alloy/src/core/contexts/context.mjs +1 -0
  11. package/dist/alloy/src/core/contexts/reflection.cjs +1 -0
  12. package/dist/alloy/src/core/contexts/reflection.mjs +1 -0
  13. package/dist/alloy/src/create-plugin.cjs +2 -0
  14. package/dist/alloy/src/create-plugin.mjs +2 -0
  15. package/dist/alloy/src/helpers/refkey.cjs +1 -0
  16. package/dist/alloy/src/helpers/refkey.mjs +1 -0
  17. package/dist/alloy/src/markdown/components/markdown-file.cjs +1 -0
  18. package/dist/alloy/src/markdown/components/markdown-file.mjs +1 -0
  19. package/dist/alloy/src/markdown/components/markdown-table.cjs +1 -0
  20. package/dist/alloy/src/markdown/components/markdown-table.mjs +1 -0
  21. package/dist/alloy/src/markdown/contexts/markdown-table.cjs +1 -0
  22. package/dist/alloy/src/markdown/contexts/markdown-table.mjs +1 -0
  23. package/dist/alloy/src/typescript/components/builtin-file.cjs +1 -0
  24. package/dist/alloy/src/typescript/components/builtin-file.mjs +1 -0
  25. package/dist/alloy/src/typescript/components/tsdoc-reflection.cjs +1 -0
  26. package/dist/alloy/src/typescript/components/tsdoc-reflection.mjs +1 -0
  27. package/dist/alloy/src/typescript/components/tsdoc.cjs +1 -0
  28. package/dist/alloy/src/typescript/components/tsdoc.mjs +1 -0
  29. package/dist/alloy/src/typescript/components/typescript-file.cjs +1 -0
  30. package/dist/alloy/src/typescript/components/typescript-file.mjs +1 -0
  31. package/dist/alloy/src/typescript/components/typescript-interface.cjs +1 -0
  32. package/dist/alloy/src/typescript/components/typescript-interface.mjs +1 -0
  33. package/dist/alloy/src/typescript/components/typescript-object.cjs +1 -0
  34. package/dist/alloy/src/typescript/components/typescript-object.mjs +1 -0
  35. package/dist/components/date-fns.cjs +513 -0
  36. package/dist/components/date-fns.d.cts +13 -0
  37. package/dist/components/date-fns.d.mts +13 -0
  38. package/dist/components/date-fns.mjs +513 -0
  39. package/dist/components/dayjs.cjs +458 -0
  40. package/dist/components/dayjs.d.cts +13 -0
  41. package/dist/components/dayjs.d.mts +13 -0
  42. package/dist/components/dayjs.mjs +458 -0
  43. package/dist/components/index.cjs +1 -0
  44. package/dist/components/index.d.mts +4 -0
  45. package/dist/components/index.mjs +1 -0
  46. package/dist/components/luxon.cjs +462 -0
  47. package/dist/components/luxon.d.cts +13 -0
  48. package/dist/components/luxon.d.mts +13 -0
  49. package/dist/components/luxon.mjs +462 -0
  50. package/dist/components/moment.cjs +448 -0
  51. package/dist/components/moment.d.cts +13 -0
  52. package/dist/components/moment.d.mts +13 -0
  53. package/dist/components/moment.mjs +448 -0
  54. package/dist/deepkit/schemas/reflection.cjs +1 -0
  55. package/dist/deepkit/schemas/reflection.d.cts +1560 -0
  56. package/dist/deepkit/schemas/reflection.d.mts +1560 -0
  57. package/dist/deepkit/schemas/reflection.mjs +1 -0
  58. package/dist/deepkit/schemas/reflection2.cjs +1 -0
  59. package/dist/deepkit/schemas/reflection2.mjs +1 -0
  60. package/dist/deepkit/src/capnp.cjs +1 -0
  61. package/dist/deepkit/src/capnp.mjs +1 -0
  62. package/dist/deepkit/src/reflect-type.cjs +1 -0
  63. package/dist/deepkit/src/reflect-type.mjs +1 -0
  64. package/dist/deepkit/src/resolve-reflections.cjs +1 -0
  65. package/dist/deepkit/src/resolve-reflections.mjs +1 -0
  66. package/dist/deepkit/src/types.d.cts +10 -0
  67. package/dist/deepkit/src/types.d.mts +10 -0
  68. package/dist/deepkit/src/utilities.cjs +1 -0
  69. package/dist/deepkit/src/utilities.mjs +1 -0
  70. package/dist/deepkit/src/vendor/type.cjs +1 -0
  71. package/dist/deepkit/src/vendor/type.d.cts +7 -0
  72. package/dist/deepkit/src/vendor/type.d.mts +7 -0
  73. package/dist/deepkit/src/vendor/type.mjs +1 -0
  74. package/dist/index.cjs +1 -1953
  75. package/dist/index.d.cts +7 -40
  76. package/dist/index.d.mts +9 -40
  77. package/dist/index.mjs +1 -1950
  78. package/dist/plugin-babel/src/helpers/ast-utils.cjs +1 -0
  79. package/dist/plugin-babel/src/helpers/ast-utils.mjs +1 -0
  80. package/dist/plugin-babel/src/helpers/create-plugin.cjs +1 -0
  81. package/dist/plugin-babel/src/helpers/create-plugin.mjs +1 -0
  82. package/dist/plugin-babel/src/helpers/filters.cjs +1 -0
  83. package/dist/plugin-babel/src/helpers/filters.mjs +1 -0
  84. package/dist/plugin-babel/src/helpers/index.cjs +1 -0
  85. package/dist/plugin-babel/src/helpers/index.mjs +1 -0
  86. package/dist/plugin-babel/src/helpers/module-helpers.cjs +1 -0
  87. package/dist/plugin-babel/src/helpers/module-helpers.mjs +1 -0
  88. package/dist/plugin-babel/src/helpers/options.cjs +1 -0
  89. package/dist/plugin-babel/src/helpers/options.mjs +1 -0
  90. package/dist/plugin-babel/src/index.cjs +1 -0
  91. package/dist/plugin-babel/src/index.mjs +1 -0
  92. package/dist/plugin-babel/src/types/index.d.mts +1 -0
  93. package/dist/plugin-babel/src/types/plugin.d.cts +15 -0
  94. package/dist/plugin-babel/src/types/plugin.d.mts +15 -0
  95. package/dist/plugin-env/src/babel/index.cjs +1 -0
  96. package/dist/plugin-env/src/babel/index.mjs +1 -0
  97. package/dist/plugin-env/src/babel/plugin.cjs +5 -0
  98. package/dist/plugin-env/src/babel/plugin.mjs +5 -0
  99. package/dist/plugin-env/src/components/docs.cjs +1 -0
  100. package/dist/plugin-env/src/components/docs.mjs +1 -0
  101. package/dist/plugin-env/src/components/env.cjs +34 -0
  102. package/dist/plugin-env/src/components/env.mjs +31 -0
  103. package/dist/plugin-env/src/components/index.cjs +1 -0
  104. package/dist/plugin-env/src/components/index.mjs +1 -0
  105. package/dist/plugin-env/src/helpers/create-reflection-resource.cjs +1 -0
  106. package/dist/plugin-env/src/helpers/create-reflection-resource.mjs +1 -0
  107. package/dist/plugin-env/src/helpers/index.cjs +1 -0
  108. package/dist/plugin-env/src/helpers/index.mjs +1 -0
  109. package/dist/plugin-env/src/helpers/load.cjs +1 -0
  110. package/dist/plugin-env/src/helpers/load.mjs +1 -0
  111. package/dist/plugin-env/src/helpers/persistence.cjs +1 -0
  112. package/dist/plugin-env/src/helpers/persistence.mjs +1 -0
  113. package/dist/plugin-env/src/helpers/reflect.cjs +1 -0
  114. package/dist/plugin-env/src/helpers/reflect.mjs +1 -0
  115. package/dist/plugin-env/src/helpers/source-file-env.cjs +1 -0
  116. package/dist/plugin-env/src/helpers/source-file-env.mjs +1 -0
  117. package/dist/plugin-env/src/helpers/template-helpers.cjs +1 -0
  118. package/dist/plugin-env/src/helpers/template-helpers.mjs +1 -0
  119. package/dist/plugin-env/src/index.cjs +16 -0
  120. package/dist/plugin-env/src/index.mjs +16 -0
  121. package/dist/plugin-env/src/types/plugin.d.cts +135 -0
  122. package/dist/plugin-env/src/types/plugin.d.mts +136 -0
  123. package/dist/plugin-env/src/types/runtime.d.cts +792 -0
  124. package/dist/plugin-env/src/types/runtime.d.mts +792 -0
  125. package/dist/powerlines/src/lib/build/esbuild.cjs +14 -0
  126. package/dist/powerlines/src/lib/build/esbuild.mjs +14 -0
  127. package/dist/powerlines/src/lib/entry.cjs +1 -0
  128. package/dist/powerlines/src/lib/entry.mjs +1 -0
  129. package/dist/powerlines/src/lib/logger.cjs +1 -0
  130. package/dist/powerlines/src/lib/logger.mjs +1 -0
  131. package/dist/powerlines/src/lib/utilities/bundle.cjs +1 -0
  132. package/dist/powerlines/src/lib/utilities/bundle.mjs +1 -0
  133. package/dist/powerlines/src/lib/utilities/file-header.cjs +10 -0
  134. package/dist/powerlines/src/lib/utilities/file-header.mjs +10 -0
  135. package/dist/powerlines/src/lib/utilities/resolve.cjs +1 -0
  136. package/dist/powerlines/src/lib/utilities/resolve.mjs +1 -0
  137. package/dist/powerlines/src/plugin-utils/helpers.cjs +1 -0
  138. package/dist/powerlines/src/plugin-utils/helpers.mjs +1 -0
  139. package/dist/powerlines/src/plugin-utils/paths.cjs +1 -0
  140. package/dist/powerlines/src/plugin-utils/paths.mjs +1 -0
  141. package/dist/powerlines/src/types/babel.d.cts +22 -0
  142. package/dist/powerlines/src/types/babel.d.mts +22 -0
  143. package/dist/powerlines/src/types/build.d.cts +139 -0
  144. package/dist/powerlines/src/types/build.d.mts +139 -0
  145. package/dist/powerlines/src/types/commands.d.cts +8 -0
  146. package/dist/powerlines/src/types/commands.d.mts +9 -0
  147. package/dist/powerlines/src/types/config.d.cts +356 -0
  148. package/dist/powerlines/src/types/config.d.mts +357 -0
  149. package/dist/powerlines/src/types/context.d.cts +358 -0
  150. package/dist/powerlines/src/types/context.d.mts +360 -0
  151. package/dist/powerlines/src/types/fs.d.cts +458 -0
  152. package/dist/powerlines/src/types/fs.d.mts +458 -0
  153. package/dist/powerlines/src/types/hooks.d.mts +2 -0
  154. package/dist/powerlines/src/types/plugin.d.cts +232 -0
  155. package/dist/powerlines/src/types/plugin.d.mts +232 -0
  156. package/dist/powerlines/src/types/resolved.d.cts +82 -0
  157. package/dist/powerlines/src/types/resolved.d.mts +82 -0
  158. package/dist/powerlines/src/types/tsconfig.d.cts +69 -0
  159. package/dist/powerlines/src/types/tsconfig.d.mts +69 -0
  160. package/dist/types/index.cjs +0 -1
  161. package/dist/types/index.d.cts +2 -3
  162. package/dist/types/index.d.mts +2 -3
  163. package/dist/types/index.mjs +1 -1
  164. package/dist/types/plugin.cjs +0 -1
  165. package/dist/types/plugin.d.cts +42 -1
  166. package/dist/types/plugin.d.mts +42 -1
  167. package/dist/types/plugin.mjs +1 -1
  168. package/dist/types/runtime.cjs +0 -1
  169. package/dist/types/runtime.d.cts +710 -1
  170. package/dist/types/runtime.d.mts +710 -1
  171. package/dist/types/runtime.mjs +1 -1
  172. package/package.json +7 -7
  173. package/dist/index-CmCelmEL.d.cts +0 -1
  174. package/dist/index-ColiPbLk.d.mts +0 -1
  175. package/dist/plugin-D3G0L2i6.d.mts +0 -4208
  176. package/dist/plugin-DHXHjv16.cjs +0 -0
  177. package/dist/plugin-DNkZTQrj.d.cts +0 -4209
  178. package/dist/plugin-alze5tBm.mjs +0 -1
  179. package/dist/runtime-0ZpEtv0G.mjs +0 -1
  180. package/dist/runtime-B8LVkjWB.d.cts +0 -711
  181. package/dist/runtime-D4zTdSwv.cjs +0 -0
  182. package/dist/runtime-DPe0V01H.d.mts +0 -711
  183. package/dist/types-CBTc19th.cjs +0 -0
  184. package/dist/types-CZFQnkin.mjs +0 -1
@@ -0,0 +1,462 @@
1
+ const e=require(`../powerlines/src/lib/utilities/file-header.cjs`);function t(t){return`
2
+ /**
3
+ * The Date module provides utility functions for date manipulation and formatting
4
+ *
5
+ * @module ${t.config.output.builtinPrefix}:date
6
+ */
7
+
8
+ ${e.getFileHeader(t)}
9
+
10
+ import { DateTime, Settings, Info } from "luxon";
11
+ import {
12
+ StormDateInterface,
13
+ DateFormats,
14
+ TimeUnit
15
+ } from "@powerlines/plugin-date/types/runtime";
16
+
17
+ export const formats: DateFormats = {
18
+ dayOfMonth: "d",
19
+ fullDate: "DD",
20
+ fullDateWithWeekday: "DDDD",
21
+ fullDateTime: "ff",
22
+ fullDateTime12h: "DD, hh:mm a",
23
+ fullDateTime24h: "DD, T",
24
+ fullTime: "t",
25
+ fullTime12h: "hh:mm a",
26
+ fullTime24h: "HH:mm",
27
+ hours12h: "hh",
28
+ hours24h: "HH",
29
+ keyboardDate: "D",
30
+ keyboardDateTime: "D t",
31
+ keyboardDateTime12h: "D hh:mm a",
32
+ keyboardDateTime24h: "D T",
33
+ systemDateTime: "D HH:mm:ss.SSS",
34
+ filePathDateTime: "D_HH-mm-ss-SSS",
35
+ minutes: "mm",
36
+ seconds: "ss",
37
+ month: "LLLL",
38
+ monthAndDate: "MMMM d",
39
+ monthAndYear: "LLLL yyyy",
40
+ monthShort: "MMM",
41
+ weekday: "cccc",
42
+ weekdayShort: "ccc",
43
+ normalDate: "d MMMM",
44
+ normalDateWithWeekday: "EEE, MMM d",
45
+ shortDate: "MMM d",
46
+ year: "yyyy",
47
+ };
48
+
49
+ export let locale = $storm.env.DEFAULT_LOCALE;
50
+
51
+ export const type = "luxon";
52
+
53
+ /**
54
+ * Creates a date object using the provided value.
55
+ *
56
+ * @remarks
57
+ * This function creates a date object using the provided value. If the value is \`null\`, it returns \`null\`. If the value is \`undefined\`, it returns the current date. If the value is a string, it parses the string as a date. If the value is a number, it treats it as a timestamp. If the value is a date object, it returns the date object.
58
+ *
59
+ * @example
60
+ * \`\`\`ts
61
+ * import { createDate } from "storm:date";
62
+ *
63
+ * const date = createDate("2023-10-01");
64
+ * console.log(date.format("YYYY-MM-DD")); // Outputs: 2023-10-01
65
+ * \`\`\`
66
+ *
67
+ * @param value - The value to create the date object from.
68
+ * @returns A date object or \`null\` if the value is \`null\`.
69
+ */
70
+ export function createDate<
71
+ TArg extends unknown = undefined,
72
+ TResultingDate extends unknown = TArg extends null
73
+ ? null
74
+ : TArg extends undefined
75
+ ? DateTime
76
+ : DateTime | null
77
+ >(value?: TArg): TResultingDate {
78
+ if (typeof value === "undefined") {
79
+ return DateTime.local() as TResultingDate;
80
+ }
81
+
82
+ if (value === null) {
83
+ return null as TResultingDate;
84
+ }
85
+
86
+ if (typeof value === "string") {
87
+ return DateTime.fromJSDate(new Date(value), { locale }) as TResultingDate;
88
+ }
89
+
90
+ if (DateTime.isDateTime(value)) {
91
+ return value as TResultingDate;
92
+ }
93
+
94
+ if (value instanceof Date) {
95
+ return DateTime.fromJSDate(value, { locale }) as TResultingDate;
96
+ }
97
+
98
+ /* istanbul ignore next */
99
+ return DateTime.local() as TResultingDate;
100
+ }
101
+
102
+ export function toJsDate(value: DateTime) {
103
+ return value.toJSDate();
104
+ };
105
+
106
+ export function parseISO(isoString: string) {
107
+ return DateTime.fromISO(isoString);
108
+ };
109
+
110
+ export function toISO(value: DateTime) {
111
+ return value.toISO({ format: "extended" });
112
+ };
113
+
114
+ export function parse(value: string, formatString: string) {
115
+ if (value === "") {
116
+ return null;
117
+ }
118
+
119
+ return DateTime.fromFormat(value, formatString, { locale });
120
+ };
121
+
122
+ /* istanbul ignore next */
123
+ export function is12HourCycleInCurrentLocale() {
124
+ if (typeof Intl === "undefined" || typeof Intl.DateTimeFormat === "undefined") {
125
+ return true; // Luxon defaults to en-US if Intl not found
126
+ }
127
+
128
+ return Boolean(
129
+ new Intl.DateTimeFormat(this.locale, { hour: "numeric" })?.resolvedOptions()?.hour12
130
+ );
131
+ };
132
+
133
+ export function getFormatHelperText(format: string) {
134
+ // Unfortunately there is no way for luxon to retrieve readable formats from localized format
135
+ return "";
136
+ };
137
+
138
+ /* istanbul ignore next */
139
+ export function getCurrentLocaleCode() {
140
+ return this.locale || Settings.defaultLocale;
141
+ };
142
+
143
+ export function addSeconds(date: DateTime, count: number) {
144
+ return date.plus({ seconds: count });
145
+ };
146
+
147
+ export function addMinutes(date: DateTime, count: number) {
148
+ return date.plus({ minutes: count });
149
+ };
150
+
151
+ export function addHours(date: DateTime, count: number) {
152
+ return date.plus({ hours: count });
153
+ };
154
+
155
+ export function addDays(date: DateTime, count: number) {
156
+ return date.plus({ days: count });
157
+ };
158
+
159
+ export function addWeeks(date: DateTime, count: number) {
160
+ return date.plus({ weeks: count });
161
+ };
162
+
163
+ export function addMonths(date: DateTime, count: number) {
164
+ return date.plus({ months: count });
165
+ };
166
+
167
+ export function addYears(date: DateTime, count: number) {
168
+ return date.plus({ years: count });
169
+ };
170
+
171
+ export function isValid(value: any) {
172
+ if (DateTime.isDateTime(value)) {
173
+ return value.isValid;
174
+ }
175
+
176
+ if (value === null) {
177
+ return false;
178
+ }
179
+
180
+ return createDate(value)?.isValid ?? false;
181
+ };
182
+
183
+ export function isEqual(value: any, comparing: any) {
184
+ if (value === null && comparing === null) {
185
+ return true;
186
+ }
187
+
188
+ // make sure that null will not be passed to createDate
189
+ if (value === null || comparing === null) {
190
+ return false;
191
+ }
192
+
193
+ if (!createDate(comparing)) {
194
+ /* istanbul ignore next */
195
+ return false;
196
+ }
197
+
198
+ return createDate(value)?.equals(createDate(comparing) as DateTime) ?? false;
199
+ };
200
+
201
+ export function isSameDay(date: DateTime, comparing: DateTime) {
202
+ return date.hasSame(comparing, "day");
203
+ };
204
+
205
+ export function isSameMonth(date: DateTime, comparing: DateTime) {
206
+ return date.hasSame(comparing, "month");
207
+ };
208
+
209
+ export function isSameYear(date: DateTime, comparing: DateTime) {
210
+ return date.hasSame(comparing, "year");
211
+ };
212
+
213
+ export function isSameHour(date: DateTime, comparing: DateTime) {
214
+ return date.hasSame(comparing, "hour");
215
+ };
216
+
217
+ export function isAfter(value: DateTime, comparing: DateTime) {
218
+ return value > comparing;
219
+ };
220
+
221
+ export function isBefore(value: DateTime, comparing: DateTime) {
222
+ return value < comparing;
223
+ };
224
+
225
+ export function isBeforeDay(value: DateTime, comparing: DateTime) {
226
+ const diff = value.diff(comparing.startOf("day"), "days").toObject();
227
+ return diff.days! < 0;
228
+ };
229
+
230
+ export function isAfterDay(value: DateTime, comparing: DateTime) {
231
+ const diff = value.diff(comparing.endOf("day"), "days").toObject();
232
+ return diff.days! > 0;
233
+ };
234
+
235
+ export function isBeforeMonth(value: DateTime, comparing: DateTime) {
236
+ const diff = value.diff(comparing.startOf("month"), "months").toObject();
237
+ return diff.months! < 0;
238
+ };
239
+
240
+ export function isAfterMonth(value: DateTime, comparing: DateTime) {
241
+ const diff = value.diff(comparing.startOf("month"), "months").toObject();
242
+ return diff.months! > 0;
243
+ };
244
+
245
+ export function isBeforeYear(value: DateTime, comparing: DateTime) {
246
+ const diff = value.diff(comparing.startOf("year"), "years").toObject();
247
+ return diff.years! < 0;
248
+ };
249
+
250
+ export function isAfterYear(value: DateTime, comparing: DateTime) {
251
+ const diff = value.diff(comparing.endOf("year"), "years").toObject();
252
+ return diff.years! > 0;
253
+ };
254
+
255
+ export function getDiff(value: DateTime, comparing: DateTime | string, unit?: TimeUnit) {
256
+ if (typeof comparing === "string") {
257
+ comparing = DateTime.fromJSDate(new Date(comparing));
258
+ }
259
+
260
+ if (!comparing.isValid) {
261
+ return 0;
262
+ }
263
+
264
+ if (unit) {
265
+ return Math.floor(value.diff(comparing).as(unit));
266
+ }
267
+
268
+ return value.diff(comparing).as("millisecond");
269
+ };
270
+
271
+ export function startOfDay(value: DateTime) {
272
+ return value.startOf("day");
273
+ };
274
+
275
+ export function endOfDay(value: DateTime) {
276
+ return value.endOf("day");
277
+ };
278
+
279
+ export function format(date: DateTime, formatKey: keyof DateFormats) {
280
+ return formatByString(date, formats[formatKey]);
281
+ };
282
+
283
+ export function formatByString(date: DateTime, format: string) {
284
+ return date.setLocale(locale).toFormat(format);
285
+ };
286
+
287
+ export function formatNumber(numberToFormat: string) {
288
+ return numberToFormat;
289
+ };
290
+
291
+ export function getHours(value: DateTime) {
292
+ return value.get("hour");
293
+ };
294
+
295
+ export function setHours(value: DateTime, count: number) {
296
+ return value.set({ hour: count });
297
+ };
298
+
299
+ export function getMinutes(value: DateTime) {
300
+ return value.get("minute");
301
+ };
302
+
303
+ export function setMinutes(value: DateTime, count: number) {
304
+ return value.set({ minute: count });
305
+ };
306
+
307
+ export function getSeconds(value: DateTime) {
308
+ return value.get("second");
309
+ };
310
+
311
+ export function setSeconds(value: DateTime, count: number) {
312
+ return value.set({ second: count });
313
+ };
314
+
315
+ export function getWeek(value: DateTime) {
316
+ return value.get("weekNumber");
317
+ };
318
+
319
+ export function getMonth(value: DateTime) {
320
+ // See https://github.com/moment/luxon/blob/master/docs/moment.md#major-functional-differences
321
+ return value.get("month") - 1;
322
+ };
323
+
324
+ export function getDaysInMonth(value: DateTime) {
325
+ return value.daysInMonth;
326
+ };
327
+
328
+ export function setMonth(value: DateTime, count: number) {
329
+ return value.set({ month: count + 1 });
330
+ };
331
+
332
+ export function getYear(value: DateTime) {
333
+ return value.get("year");
334
+ };
335
+
336
+ export function setYear(value: DateTime, year: number) {
337
+ return value.set({ year });
338
+ };
339
+
340
+ export function getDate(value: DateTime) {
341
+ return value.get("day");
342
+ };
343
+
344
+ export function setDate(value: DateTime, day: number) {
345
+ return value.set({ day });
346
+ };
347
+
348
+ export function mergeDateAndTime(date: DateTime, time: DateTime) {
349
+ return date.set({
350
+ second: time.second,
351
+ hour: time.hour,
352
+ minute: time.minute,
353
+ });
354
+ };
355
+
356
+ export function startOfYear(value: DateTime) {
357
+ return value.startOf("year");
358
+ };
359
+
360
+ export function endOfYear(value: DateTime) {
361
+ return value.endOf("year");
362
+ };
363
+
364
+ export function startOfMonth(value: DateTime) {
365
+ return value.startOf("month");
366
+ };
367
+
368
+ export function endOfMonth(value: DateTime) {
369
+ return value.endOf("month");
370
+ };
371
+
372
+ export function startOfWeek(value: DateTime) {
373
+ return value.startOf("week");
374
+ };
375
+
376
+ export function endOfWeek(value: DateTime) {
377
+ return value.endOf("week");
378
+ };
379
+
380
+ export function getNextMonth(value: DateTime) {
381
+ return value.plus({ months: 1 });
382
+ };
383
+
384
+ export function getPreviousMonth(value: DateTime) {
385
+ return value.minus({ months: 1 });
386
+ };
387
+
388
+ export function getMonthArray(date: DateTime) {
389
+ const firstMonth = date.startOf("year");
390
+ const monthArray = [firstMonth];
391
+
392
+ while (monthArray.length < 12) {
393
+ const prevMonth = monthArray[monthArray.length - 1];
394
+ monthArray.push(this.getNextMonth(prevMonth));
395
+ }
396
+
397
+ return monthArray;
398
+ };
399
+
400
+ export function getWeekdays() {
401
+ return Info.weekdaysFormat("short", { locale });
402
+ };
403
+
404
+ export function getWeekArray(date: DateTime) {
405
+ const { days } = date
406
+ .endOf("month")
407
+ .endOf("week")
408
+ .diff(date.startOf("month").startOf("week"), "days")
409
+ .toObject();
410
+
411
+ const weeks: DateTime[][] = [];
412
+ new Array<number>(Math.round(days!))
413
+ .fill(0)
414
+ .map((_, i) => i)
415
+ .map((day) => date.startOf("month").startOf("week").plus({ days: day }))
416
+ .forEach((v, i) => {
417
+ if (i === 0 || (i % 7 === 0 && i > 6)) {
418
+ weeks.push([v]);
419
+ return;
420
+ }
421
+
422
+ weeks[weeks.length - 1].push(v);
423
+ });
424
+
425
+ return weeks;
426
+ };
427
+
428
+ export function getYearRange(start: DateTime, end: DateTime) {
429
+ const startDate = start.startOf("year");
430
+ const endDate = end.endOf("year");
431
+
432
+ let current = startDate;
433
+ const years: DateTime[] = [];
434
+
435
+ while (current < endDate) {
436
+ years.push(current);
437
+ current = current.plus({ year: 1 });
438
+ }
439
+
440
+ return years;
441
+ };
442
+
443
+ export function getMeridiemText(meridiem: "am" | "pm") {
444
+ return Info.meridiems({ locale }).find(
445
+ (v) => v.toLowerCase() === meridiem.toLowerCase()
446
+ )!;
447
+ };
448
+
449
+ export function isNull(date: DateTime | null) {
450
+ return date === null;
451
+ };
452
+
453
+ export function isWithinRange(date: DateTime, [start, end]: [DateTime, DateTime]) {
454
+ return (
455
+ date.equals(start) ||
456
+ date.equals(end) ||
457
+ (isAfter(date, start) && isBefore(date, end))
458
+ );
459
+ };
460
+
461
+
462
+ `}exports.luxonModule=t;
@@ -0,0 +1,13 @@
1
+ import { DatePluginContext } from "../types/plugin.cjs";
2
+
3
+ //#region src/components/luxon.d.ts
4
+
5
+ /**
6
+ * Generates the Powerlines configuration file.
7
+ *
8
+ * @param context - The build context containing runtime information.
9
+ * @returns A string representing the configuration file content.
10
+ */
11
+ declare function luxonModule(context: DatePluginContext): string;
12
+ //#endregion
13
+ export { luxonModule };
@@ -0,0 +1,13 @@
1
+ import { DatePluginContext } from "../types/plugin.mjs";
2
+
3
+ //#region src/components/luxon.d.ts
4
+
5
+ /**
6
+ * Generates the Powerlines configuration file.
7
+ *
8
+ * @param context - The build context containing runtime information.
9
+ * @returns A string representing the configuration file content.
10
+ */
11
+ declare function luxonModule(context: DatePluginContext): string;
12
+ //#endregion
13
+ export { luxonModule };