@powerlines/plugin-date 0.12.66 → 0.12.68

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-CU36jSR5.d.mts +0 -4211
  176. package/dist/plugin-DHXHjv16.cjs +0 -0
  177. package/dist/plugin-DxCv7BdD.d.cts +0 -4212
  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,448 @@
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 defaultMoment, { LongDateFormatKey } from "moment";
11
+ import {
12
+ StormDateInterface,
13
+ DateFormats,
14
+ TimeUnit
15
+ } from "@powerlines/plugin-date/types/runtime";
16
+
17
+ type Moment = defaultMoment.Moment;
18
+
19
+ export const formats: DateFormats = {
20
+ normalDateWithWeekday: "ddd, MMM D",
21
+ normalDate: "D MMMM",
22
+ shortDate: "MMM D",
23
+ monthAndDate: "MMMM D",
24
+ dayOfMonth: "D",
25
+ year: "YYYY",
26
+ month: "MMMM",
27
+ monthShort: "MMM",
28
+ monthAndYear: "MMMM YYYY",
29
+ weekday: "dddd",
30
+ weekdayShort: "ddd",
31
+ minutes: "mm",
32
+ hours12h: "hh",
33
+ hours24h: "HH",
34
+ seconds: "ss",
35
+ fullTime: "LT",
36
+ fullTime12h: "hh:mm A",
37
+ fullTime24h: "HH:mm",
38
+ fullDate: "ll",
39
+ fullDateWithWeekday: "dddd, LL",
40
+ fullDateTime: "lll",
41
+ fullDateTime12h: "ll hh:mm A",
42
+ fullDateTime24h: "ll HH:mm",
43
+ keyboardDate: "L",
44
+ keyboardDateTime: "L LT",
45
+ keyboardDateTime12h: "L hh:mm A",
46
+ keyboardDateTime24h: "L HH:mm",
47
+ systemDateTime: "L HH:mm:ss.SSS",
48
+ filePathDateTime: "L_HH-mm-ss-SSS"
49
+ };
50
+
51
+ export let locale = $storm.env.DEFAULT_LOCALE;
52
+
53
+ export const type = "moment";
54
+
55
+ const moment = defaultMoment;
56
+
57
+ /**
58
+ * Creates a date object using the provided value.
59
+ *
60
+ * @remarks
61
+ * 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.
62
+ *
63
+ * @example
64
+ * \`\`\`ts
65
+ * import { createDate } from "storm:date";
66
+ *
67
+ * const date = createDate("2023-10-01");
68
+ * console.log(date.format("YYYY-MM-DD")); // Outputs: 2023-10-01
69
+ * \`\`\`
70
+ *
71
+ * @param value - The value to create the date object from.
72
+ * @returns A date object or \`null\` if the value is \`null\`.
73
+ */
74
+ export function createDate<
75
+ TArg extends unknown = undefined,
76
+ TResultingDate extends unknown = TArg extends null
77
+ ? null
78
+ : TArg extends undefined
79
+ ? defaultMoment.Moment
80
+ : defaultMoment.Moment | null
81
+ >(value?: TArg): TResultingDate {
82
+ if (value === null) {
83
+ return null as TResultingDate;
84
+ }
85
+
86
+ const _moment = moment(value);
87
+ if (locale) {
88
+ _moment.locale(locale);
89
+ }
90
+
91
+ return _moment as TResultingDate;
92
+ }
93
+
94
+
95
+ export function is12HourCycleInCurrentLocale(): boolean {
96
+ return /A|a/.test(
97
+ moment.localeData(getCurrentLocaleCode()).longDateFormat("LT")
98
+ );
99
+ };
100
+
101
+ export function getFormatHelperText(format: string) {
102
+ // @see https://github.com/moment/moment/blob/develop/src/lib/format/format.js#L6
103
+ const localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})|./g;
104
+
105
+ return (
106
+ format
107
+ .match(localFormattingTokens)
108
+ ?.map((token) => {
109
+ const firstCharacter = token[0];
110
+ if (firstCharacter === "L" || firstCharacter === ";") {
111
+ return moment
112
+ .localeData(getCurrentLocaleCode())
113
+ .longDateFormat(token as LongDateFormatKey);
114
+ }
115
+
116
+ return token;
117
+ })
118
+ .join("")
119
+ .replace(/a/gi, "(a|p)m")
120
+ .toLocaleLowerCase() ?? format
121
+ );
122
+ };
123
+
124
+ export function getCurrentLocaleCode() {
125
+ return locale || moment.locale();
126
+ };
127
+
128
+ export function parseISO(isoString: string) {
129
+ return moment(isoString, true);
130
+ };
131
+
132
+ export function toISO(value: Moment) {
133
+ return value.toISOString();
134
+ };
135
+
136
+ export function parse(value: string, format: string) {
137
+ if (value === "") {
138
+ return null;
139
+ }
140
+
141
+ if (locale) {
142
+ return moment(value, format, locale, true);
143
+ }
144
+
145
+ return moment(value, format, true);
146
+ };
147
+
148
+ export function toJsDate(value: Moment) {
149
+ return value.toDate();
150
+ };
151
+
152
+ export function isValid(value: any) {
153
+ return moment(value).isValid();
154
+ };
155
+
156
+ export function isNull(date: Moment) {
157
+ return date === null;
158
+ };
159
+
160
+ export function getDiff(date: Moment, comparing: Moment | string, unit?: TimeUnit) {
161
+ if (!moment(comparing).isValid()) {
162
+ return 0;
163
+ }
164
+
165
+ return date.diff(comparing, unit);
166
+ };
167
+
168
+ export function isAfter(date: Moment, value: Moment) {
169
+ return date.isAfter(value);
170
+ };
171
+
172
+ export function isBefore(date: Moment, value: Moment) {
173
+ return date.isBefore(value);
174
+ };
175
+
176
+ export function isAfterDay(date: Moment, value: Moment) {
177
+ return date.isAfter(value, "day");
178
+ };
179
+
180
+ export function isBeforeDay(date: Moment, value: Moment) {
181
+ return date.isBefore(value, "day");
182
+ };
183
+
184
+ export function isBeforeMonth(date: Moment, value: Moment) {
185
+ return date.isBefore(value, "month");
186
+ };
187
+
188
+ export function isAfterMonth(date: Moment, value: Moment) {
189
+ return date.isAfter(value, "month");
190
+ };
191
+
192
+ export function isBeforeYear(date: Moment, value: Moment) {
193
+ return date.isBefore(value, "year");
194
+ };
195
+
196
+ export function isAfterYear(date: Moment, value: Moment) {
197
+ return date.isAfter(value, "year");
198
+ };
199
+
200
+ export function startOfDay(date: Moment) {
201
+ return date.clone().startOf("day");
202
+ };
203
+
204
+ export function endOfDay(date: Moment) {
205
+ return date.clone().endOf("day");
206
+ };
207
+
208
+ export function format(date: Moment, formatKey: keyof DateFormats) {
209
+ return formatByString(date, formats[formatKey]);
210
+ };
211
+
212
+ export function formatByString(date: Moment, formatString: string) {
213
+ const clonedDate = date.clone();
214
+ if (locale) {
215
+ clonedDate.locale(locale);
216
+ }
217
+ return clonedDate.format(formatString);
218
+ };
219
+
220
+ export function formatNumber(numberToFormat: string) {
221
+ return numberToFormat;
222
+ };
223
+
224
+ export function getHours(date: Moment) {
225
+ return date.get("hours");
226
+ };
227
+
228
+ export function addSeconds(date: Moment, count: number) {
229
+ return count < 0
230
+ ? date.clone().subtract(Math.abs(count), "seconds")
231
+ : date.clone().add(count, "seconds");
232
+ };
233
+
234
+ export function addMinutes(date: Moment, count: number) {
235
+ return count < 0
236
+ ? date.clone().subtract(Math.abs(count), "minutes")
237
+ : date.clone().add(count, "minutes");
238
+ };
239
+
240
+ export function addHours(date: Moment, count: number) {
241
+ return count < 0
242
+ ? date.clone().subtract(Math.abs(count), "hours")
243
+ : date.clone().add(count, "hours");
244
+ };
245
+
246
+ export function addDays(date: Moment, count: number) {
247
+ return count < 0
248
+ ? date.clone().subtract(Math.abs(count), "days")
249
+ : date.clone().add(count, "days");
250
+ };
251
+
252
+ export function addWeeks(date: Moment, count: number) {
253
+ return count < 0
254
+ ? date.clone().subtract(Math.abs(count), "weeks")
255
+ : date.clone().add(count, "weeks");
256
+ };
257
+
258
+ export function addMonths(date: Moment, count: number) {
259
+ return count < 0
260
+ ? date.clone().subtract(Math.abs(count), "months")
261
+ : date.clone().add(count, "months");
262
+ };
263
+
264
+ export function addYears(date: Moment, count: number) {
265
+ return count < 0
266
+ ? date.clone().subtract(Math.abs(count), "years")
267
+ : date.clone().add(count, "years");
268
+ };
269
+
270
+ export function setHours(date: Moment, count: number) {
271
+ return date.clone().hours(count);
272
+ };
273
+
274
+ export function getMinutes(date: Moment) {
275
+ return date.get("minutes");
276
+ };
277
+
278
+ export function setMinutes(date: Moment, count: number) {
279
+ return date.clone().minutes(count);
280
+ };
281
+
282
+ export function getSeconds(date: Moment) {
283
+ return date.get("seconds");
284
+ };
285
+
286
+ export function setSeconds(date: Moment, count: number) {
287
+ return date.clone().seconds(count);
288
+ };
289
+
290
+ export function getWeek(date: Moment) {
291
+ return date.get("week");
292
+ };
293
+
294
+ export function getMonth(date: Moment) {
295
+ return date.get("month");
296
+ };
297
+
298
+ export function getDaysInMonth(date: Moment) {
299
+ return date.daysInMonth();
300
+ };
301
+
302
+ export function isSameDay(date: Moment, comparing: Moment) {
303
+ return date.isSame(comparing, "day");
304
+ };
305
+
306
+ export function isSameMonth(date: Moment, comparing: Moment) {
307
+ return date.isSame(comparing, "month");
308
+ };
309
+
310
+ export function isSameYear(date: Moment, comparing: Moment) {
311
+ return date.isSame(comparing, "year");
312
+ };
313
+
314
+ export function isSameHour(date: Moment, comparing: Moment) {
315
+ return date.isSame(comparing, "hour");
316
+ };
317
+
318
+ export function setMonth(date: Moment, count: number) {
319
+ return date.clone().month(count);
320
+ };
321
+
322
+ export function getMeridiemText(meridiem: "am" | "pm") {
323
+ if (is12HourCycleInCurrentLocale()) {
324
+ // AM/PM translation only possible in those who have 12 hour cycle in locale.
325
+ return moment
326
+ .localeData(getCurrentLocaleCode())
327
+ .meridiem(meridiem === "am" ? 0 : 13, 0, false);
328
+ }
329
+
330
+ return meridiem === "am" ? "AM" : "PM"; // fallback for de, ru, ...etc
331
+ };
332
+
333
+ export function startOfYear(date: Moment) {
334
+ return date.clone().startOf("year");
335
+ };
336
+
337
+ export function endOfYear(date: Moment) {
338
+ return date.clone().endOf("year");
339
+ };
340
+
341
+ export function startOfMonth(date: Moment) {
342
+ return date.clone().startOf("month");
343
+ };
344
+
345
+ export function endOfMonth(date: Moment) {
346
+ return date.clone().endOf("month");
347
+ };
348
+
349
+ export function startOfWeek(date: Moment) {
350
+ return date.clone().startOf("week");
351
+ };
352
+
353
+ export function endOfWeek(date: Moment) {
354
+ return date.clone().endOf("week");
355
+ };
356
+
357
+ export function getNextMonth(date: Moment) {
358
+ return date.clone().add(1, "month");
359
+ };
360
+
361
+ export function getPreviousMonth(date: Moment) {
362
+ return date.clone().subtract(1, "month");
363
+ };
364
+
365
+ export function getMonthArray(date: Moment) {
366
+ const firstMonth = date.clone().startOf("year");
367
+ const monthArray = [firstMonth];
368
+
369
+ while (monthArray.length < 12) {
370
+ const prevMonth = monthArray[monthArray.length - 1];
371
+ monthArray.push(getNextMonth(prevMonth));
372
+ }
373
+
374
+ return monthArray;
375
+ };
376
+
377
+ export function getYear(date: Moment) {
378
+ return date.get("year");
379
+ };
380
+
381
+ export function setYear(date: Moment, year: number) {
382
+ return date.clone().set("year", year);
383
+ };
384
+
385
+ export function getDate(date: Moment) {
386
+ return date.get("date");
387
+ };
388
+
389
+ export function setDate(date: Moment, day: number) {
390
+ return date.clone().set("date", day);
391
+ };
392
+
393
+ export function mergeDateAndTime(date: Moment, time: Moment) {
394
+ return date.hour(time.hour()).minute(time.minute()).second(time.second());
395
+ };
396
+
397
+ export function getWeekdays() {
398
+ return moment.weekdaysShort(true);
399
+ };
400
+
401
+ export function isEqual(value: any, comparing: any) {
402
+ if (value === null && comparing === null) {
403
+ return true;
404
+ }
405
+
406
+ return moment(value).isSame(comparing);
407
+ };
408
+
409
+ export function getWeekArray(date: Moment) {
410
+ const start = date.clone().startOf("month").startOf("week");
411
+ const end = date.clone().endOf("month").endOf("week");
412
+
413
+ let count = 0;
414
+ let current = start;
415
+ const nestedWeeks: Moment[][] = [];
416
+
417
+ while (current.isBefore(end)) {
418
+ const weekNumber = Math.floor(count / 7);
419
+ nestedWeeks[weekNumber] = nestedWeeks[weekNumber] || [];
420
+ nestedWeeks[weekNumber].push(current);
421
+
422
+ current = current.clone().add(1, "day");
423
+ count += 1;
424
+ }
425
+
426
+ return nestedWeeks;
427
+ };
428
+
429
+ export function getYearRange(start: Moment, end: Moment) {
430
+ const startDate = moment(start).startOf("year");
431
+ const endDate = moment(end).endOf("year");
432
+ const years: Moment[] = [];
433
+
434
+ let current = startDate;
435
+ while (current.isBefore(endDate)) {
436
+ years.push(current);
437
+ current = current.clone().add(1, "year");
438
+ }
439
+
440
+ return years;
441
+ };
442
+
443
+ export function isWithinRange(date: Moment, [start, end]: [Moment, Moment]) {
444
+ return date.isBetween(start, end, null, "[]");
445
+ };
446
+
447
+
448
+ `}exports.momentModule=t;
@@ -0,0 +1,13 @@
1
+ import { DatePluginContext } from "../types/plugin.cjs";
2
+
3
+ //#region src/components/moment.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 momentModule(context: DatePluginContext): string;
12
+ //#endregion
13
+ export { momentModule };
@@ -0,0 +1,13 @@
1
+ import { DatePluginContext } from "../types/plugin.mjs";
2
+
3
+ //#region src/components/moment.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 momentModule(context: DatePluginContext): string;
12
+ //#endregion
13
+ export { momentModule };