rrule-temporal 1.0.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/totext.js CHANGED
@@ -1,18 +1,10 @@
1
1
  import {
2
2
  RRuleTemporal
3
- } from "./chunk-U2SCUIWP.js";
3
+ } from "./chunk-6A2XASAM.js";
4
4
 
5
5
  // src/totext.ts
6
6
  var en = {
7
- weekdayNames: [
8
- "Monday",
9
- "Tuesday",
10
- "Wednesday",
11
- "Thursday",
12
- "Friday",
13
- "Saturday",
14
- "Sunday"
15
- ],
7
+ weekdayNames: ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"],
16
8
  monthNames: [
17
9
  "January",
18
10
  "February",
@@ -26,21 +18,401 @@ var en = {
26
18
  "October",
27
19
  "November",
28
20
  "December"
29
- ]
21
+ ],
22
+ units: {
23
+ year: { singular: "year", plural: "years" },
24
+ month: { singular: "month", plural: "months" },
25
+ week: { singular: "week", plural: "weeks" },
26
+ day: { singular: "day", plural: "days" },
27
+ hour: { singular: "hour", plural: "hours" },
28
+ minute: { singular: "minute", plural: "minutes" },
29
+ second: { singular: "second", plural: "seconds" }
30
+ },
31
+ words: {
32
+ every: "every",
33
+ weekday: "weekday",
34
+ on: "on",
35
+ in: "in",
36
+ on_the: "on the",
37
+ day_of_month: "day of the month",
38
+ day_of_year: "day of the year",
39
+ in_week: "in week",
40
+ at: "at",
41
+ at_minute: "at minute",
42
+ at_second: "at second",
43
+ until: "until",
44
+ for: "for",
45
+ time: "time",
46
+ times: "times",
47
+ instance: "instance",
48
+ week_starts_on: "week starts on",
49
+ with: "with",
50
+ additional_date: "additional date",
51
+ additional_dates: "additional dates",
52
+ excluding: "excluding",
53
+ date: "date",
54
+ dates: "dates",
55
+ and: "and",
56
+ last: "last"
57
+ },
58
+ ordinal: (n) => {
59
+ const abs = Math.abs(n);
60
+ const suffix = abs % 10 === 1 && abs % 100 !== 11 ? "st" : abs % 10 === 2 && abs % 100 !== 12 ? "nd" : abs % 10 === 3 && abs % 100 !== 13 ? "rd" : "th";
61
+ return n < 0 ? `last` : `${abs}${suffix}`;
62
+ }
63
+ };
64
+ var es = {
65
+ weekdayNames: ["lunes", "martes", "mi\xE9rcoles", "jueves", "viernes", "s\xE1bado", "domingo"],
66
+ monthNames: [
67
+ "enero",
68
+ "febrero",
69
+ "marzo",
70
+ "abril",
71
+ "mayo",
72
+ "junio",
73
+ "julio",
74
+ "agosto",
75
+ "septiembre",
76
+ "octubre",
77
+ "noviembre",
78
+ "diciembre"
79
+ ],
80
+ units: {
81
+ year: { singular: "a\xF1o", plural: "a\xF1os" },
82
+ month: { singular: "mes", plural: "meses" },
83
+ week: { singular: "semana", plural: "semanas" },
84
+ day: { singular: "d\xEDa", plural: "d\xEDas" },
85
+ hour: { singular: "hora", plural: "horas" },
86
+ minute: { singular: "minuto", plural: "minutos" },
87
+ second: { singular: "segundo", plural: "segundos" }
88
+ },
89
+ words: {
90
+ every: "cada",
91
+ weekday: "d\xEDa de la semana",
92
+ on: "en",
93
+ in: "en",
94
+ on_the: "el",
95
+ day_of_month: "d\xEDa del mes",
96
+ day_of_year: "d\xEDa del a\xF1o",
97
+ in_week: "en la semana",
98
+ at: "a las",
99
+ at_minute: "en el minuto",
100
+ at_second: "en el segundo",
101
+ until: "hasta",
102
+ for: "durante",
103
+ time: "vez",
104
+ times: "veces",
105
+ instance: "ocasi\xF3n",
106
+ week_starts_on: "la semana comienza el",
107
+ with: "con",
108
+ additional_date: "fecha adicional",
109
+ additional_dates: "fechas adicionales",
110
+ excluding: "excluyendo",
111
+ date: "fecha",
112
+ dates: "fechas",
113
+ and: "y",
114
+ last: "\xFAltimo"
115
+ },
116
+ ordinal: (n) => n < 0 ? "\xFAltimo" : `${Math.abs(n)}\xBA`
30
117
  };
31
- var ALL_LOCALES = { en };
118
+ var hi = {
119
+ weekdayNames: ["\u0938\u094B\u092E\u0935\u093E\u0930", "\u092E\u0902\u0917\u0932\u0935\u093E\u0930", "\u092C\u0941\u0927\u0935\u093E\u0930", "\u0917\u0941\u0930\u0941\u0935\u093E\u0930", "\u0936\u0941\u0915\u094D\u0930\u0935\u093E\u0930", "\u0936\u0928\u093F\u0935\u093E\u0930", "\u0930\u0935\u093F\u0935\u093E\u0930"],
120
+ monthNames: [
121
+ "\u091C\u0928\u0935\u0930\u0940",
122
+ "\u092B\u0930\u0935\u0930\u0940",
123
+ "\u092E\u093E\u0930\u094D\u091A",
124
+ "\u0905\u092A\u094D\u0930\u0948\u0932",
125
+ "\u092E\u0908",
126
+ "\u091C\u0942\u0928",
127
+ "\u091C\u0941\u0932\u093E\u0908",
128
+ "\u0905\u0917\u0938\u094D\u0924",
129
+ "\u0938\u093F\u0924\u0902\u092C\u0930",
130
+ "\u0905\u0915\u094D\u091F\u0942\u092C\u0930",
131
+ "\u0928\u0935\u0902\u092C\u0930",
132
+ "\u0926\u093F\u0938\u0902\u092C\u0930"
133
+ ],
134
+ units: {
135
+ year: { singular: "\u0938\u093E\u0932", plural: "\u0938\u093E\u0932" },
136
+ month: { singular: "\u092E\u0939\u0940\u0928\u093E", plural: "\u092E\u0939\u0940\u0928\u0947" },
137
+ week: { singular: "\u0938\u092A\u094D\u0924\u093E\u0939", plural: "\u0938\u092A\u094D\u0924\u093E\u0939" },
138
+ day: { singular: "\u0926\u093F\u0928", plural: "\u0926\u093F\u0928" },
139
+ hour: { singular: "\u0918\u0902\u091F\u093E", plural: "\u0918\u0902\u091F\u0947" },
140
+ minute: { singular: "\u092E\u093F\u0928\u091F", plural: "\u092E\u093F\u0928\u091F" },
141
+ second: { singular: "\u0938\u0947\u0915\u0902\u0921", plural: "\u0938\u0947\u0915\u0902\u0921" }
142
+ },
143
+ words: {
144
+ every: "\u0939\u0930",
145
+ weekday: "\u0938\u092A\u094D\u0924\u093E\u0939 \u0915\u093E \u0926\u093F\u0928",
146
+ on: "\u0915\u094B",
147
+ in: "\u092E\u0947\u0902",
148
+ on_the: "\u0915\u094B",
149
+ day_of_month: "\u092E\u0939\u0940\u0928\u0947 \u0915\u093E \u0926\u093F\u0928",
150
+ day_of_year: "\u0938\u093E\u0932 \u0915\u093E \u0926\u093F\u0928",
151
+ in_week: "\u0938\u092A\u094D\u0924\u093E\u0939",
152
+ at: "\u092A\u0930",
153
+ at_minute: "\u092E\u093F\u0928\u091F \u092A\u0930",
154
+ at_second: "\u0938\u0947\u0915\u0902\u0921 \u092A\u0930",
155
+ until: "\u0924\u0915",
156
+ for: "\u0915\u0947 \u0932\u093F\u090F",
157
+ time: "\u092C\u093E\u0930",
158
+ times: "\u092C\u093E\u0930",
159
+ instance: "\u092C\u093E\u0930",
160
+ week_starts_on: "\u0938\u092A\u094D\u0924\u093E\u0939 \u0936\u0941\u0930\u0942 \u0939\u094B\u0924\u093E \u0939\u0948",
161
+ with: "\u0938\u093E\u0925",
162
+ additional_date: "\u0905\u0924\u093F\u0930\u093F\u0915\u094D\u0924 \u0924\u093E\u0930\u0940\u0916",
163
+ additional_dates: "\u0905\u0924\u093F\u0930\u093F\u0915\u094D\u0924 \u0924\u093E\u0930\u0940\u0916\u0947\u0902",
164
+ excluding: "\u0915\u094B \u091B\u094B\u0921\u093C\u0915\u0930",
165
+ date: "\u0924\u093E\u0930\u0940\u0916",
166
+ dates: "\u0924\u093E\u0930\u0940\u0916\u0947\u0902",
167
+ and: "\u0914\u0930",
168
+ last: "\u0906\u0916\u093F\u0930\u0940"
169
+ },
170
+ ordinal: (n) => n < 0 ? "\u0906\u0916\u093F\u0930\u0940" : `${Math.abs(n)}\u0935\u093E\u0902`
171
+ };
172
+ var yue = {
173
+ weekdayNames: ["\u661F\u671F\u4E00", "\u661F\u671F\u4E8C", "\u661F\u671F\u4E09", "\u661F\u671F\u56DB", "\u661F\u671F\u4E94", "\u661F\u671F\u516D", "\u661F\u671F\u65E5"],
174
+ monthNames: ["\u4E00\u6708", "\u4E8C\u6708", "\u4E09\u6708", "\u56DB\u6708", "\u4E94\u6708", "\u516D\u6708", "\u4E03\u6708", "\u516B\u6708", "\u4E5D\u6708", "\u5341\u6708", "\u5341\u4E00\u6708", "\u5341\u4E8C\u6708"],
175
+ units: {
176
+ year: { singular: "\u5E74", plural: "\u5E74" },
177
+ month: { singular: "\u6708", plural: "\u6708" },
178
+ week: { singular: "\u9031", plural: "\u9031" },
179
+ day: { singular: "\u65E5", plural: "\u65E5" },
180
+ hour: { singular: "\u5C0F\u6642", plural: "\u5C0F\u6642" },
181
+ minute: { singular: "\u5206\u9418", plural: "\u5206\u9418" },
182
+ second: { singular: "\u79D2", plural: "\u79D2" }
183
+ },
184
+ words: {
185
+ every: "\u6BCF",
186
+ weekday: "\u5E73\u65E5",
187
+ on: "\u5728",
188
+ in: "\u65BC",
189
+ on_the: "\u5728",
190
+ day_of_month: "\u6708\u7684\u65E5\u5B50",
191
+ day_of_year: "\u5E74\u7684\u65E5\u5B50",
192
+ in_week: "\u7B2C",
193
+ at: "\u5728",
194
+ at_minute: "\u5728\u7B2C",
195
+ at_second: "\u5728\u7B2C",
196
+ until: "\u76F4\u5230",
197
+ for: "\u5171",
198
+ time: "\u6B21",
199
+ times: "\u6B21",
200
+ instance: "\u6B21",
201
+ week_starts_on: "\u661F\u671F\u958B\u59CB\u65BC",
202
+ with: "\u5E36\u6709",
203
+ additional_date: "\u984D\u5916\u65E5\u671F",
204
+ additional_dates: "\u984D\u5916\u65E5\u671F",
205
+ excluding: "\u6392\u9664",
206
+ date: "\u65E5\u671F",
207
+ dates: "\u65E5\u671F",
208
+ and: "\u548C",
209
+ last: "\u6700\u5F8C"
210
+ },
211
+ ordinal: (n) => n < 0 ? "\u6700\u5F8C" : `\u7B2C${Math.abs(n)}`
212
+ };
213
+ var ar = {
214
+ weekdayNames: ["\u0627\u0644\u0627\u062B\u0646\u064A\u0646", "\u0627\u0644\u062B\u0644\u0627\u062B\u0627\u0621", "\u0627\u0644\u0623\u0631\u0628\u0639\u0627\u0621", "\u0627\u0644\u062E\u0645\u064A\u0633", "\u0627\u0644\u062C\u0645\u0639\u0629", "\u0627\u0644\u0633\u0628\u062A", "\u0627\u0644\u0623\u062D\u062F"],
215
+ monthNames: [
216
+ "\u064A\u0646\u0627\u064A\u0631",
217
+ "\u0641\u0628\u0631\u0627\u064A\u0631",
218
+ "\u0645\u0627\u0631\u0633",
219
+ "\u0623\u0628\u0631\u064A\u0644",
220
+ "\u0645\u0627\u064A\u0648",
221
+ "\u064A\u0648\u0646\u064A\u0648",
222
+ "\u064A\u0648\u0644\u064A\u0648",
223
+ "\u0623\u063A\u0633\u0637\u0633",
224
+ "\u0633\u0628\u062A\u0645\u0628\u0631",
225
+ "\u0623\u0643\u062A\u0648\u0628\u0631",
226
+ "\u0646\u0648\u0641\u0645\u0628\u0631",
227
+ "\u062F\u064A\u0633\u0645\u0628\u0631"
228
+ ],
229
+ units: {
230
+ year: { singular: "\u0633\u0646\u0629", plural: "\u0633\u0646\u0648\u0627\u062A" },
231
+ month: { singular: "\u0634\u0647\u0631", plural: "\u0623\u0634\u0647\u0631" },
232
+ week: { singular: "\u0623\u0633\u0628\u0648\u0639", plural: "\u0623\u0633\u0627\u0628\u064A\u0639" },
233
+ day: { singular: "\u064A\u0648\u0645", plural: "\u0623\u064A\u0627\u0645" },
234
+ hour: { singular: "\u0633\u0627\u0639\u0629", plural: "\u0633\u0627\u0639\u0627\u062A" },
235
+ minute: { singular: "\u062F\u0642\u064A\u0642\u0629", plural: "\u062F\u0642\u0627\u0626\u0642" },
236
+ second: { singular: "\u062B\u0627\u0646\u064A\u0629", plural: "\u062B\u0648\u0627\u0646\u064A" }
237
+ },
238
+ words: {
239
+ every: "\u0643\u0644",
240
+ weekday: "\u064A\u0648\u0645 \u0645\u0646 \u0623\u064A\u0627\u0645 \u0627\u0644\u0623\u0633\u0628\u0648\u0639",
241
+ on: "\u0641\u064A",
242
+ in: "\u0641\u064A",
243
+ on_the: "\u0641\u064A \u0627\u0644\u0640",
244
+ day_of_month: "\u064A\u0648\u0645 \u0645\u0646 \u0627\u0644\u0634\u0647\u0631",
245
+ day_of_year: "\u064A\u0648\u0645 \u0645\u0646 \u0627\u0644\u0633\u0646\u0629",
246
+ in_week: "\u0641\u064A \u0627\u0644\u0623\u0633\u0628\u0648\u0639",
247
+ at: "\u0639\u0646\u062F",
248
+ at_minute: "\u0641\u064A \u0627\u0644\u062F\u0642\u064A\u0642\u0629",
249
+ at_second: "\u0641\u064A \u0627\u0644\u062B\u0627\u0646\u064A\u0629",
250
+ until: "\u062D\u062A\u0649",
251
+ for: "\u0644\u0645\u062F\u0629",
252
+ time: "\u0645\u0631\u0629",
253
+ times: "\u0645\u0631\u0627\u062A",
254
+ instance: "\u0645\u0631\u0629",
255
+ week_starts_on: "\u064A\u0628\u062F\u0623 \u0627\u0644\u0623\u0633\u0628\u0648\u0639 \u064A\u0648\u0645",
256
+ with: "\u0645\u0639",
257
+ additional_date: "\u062A\u0627\u0631\u064A\u062E \u0625\u0636\u0627\u0641\u064A",
258
+ additional_dates: "\u062A\u0648\u0627\u0631\u064A\u062E \u0625\u0636\u0627\u0641\u064A\u0629",
259
+ excluding: "\u0628\u0627\u0633\u062A\u062B\u0646\u0627\u0621",
260
+ date: "\u062A\u0627\u0631\u064A\u062E",
261
+ dates: "\u062A\u0648\u0627\u0631\u064A\u062E",
262
+ and: "\u0648",
263
+ last: "\u0627\u0644\u0623\u062E\u064A\u0631"
264
+ },
265
+ ordinal: (n) => {
266
+ if (n < 0) return "\u0627\u0644\u0623\u062E\u064A\u0631";
267
+ const abs = Math.abs(n);
268
+ const map = {
269
+ 1: "\u0627\u0644\u0623\u0648\u0644",
270
+ 2: "\u0627\u0644\u062B\u0627\u0646\u064A",
271
+ 3: "\u0627\u0644\u062B\u0627\u0644\u062B",
272
+ 4: "\u0627\u0644\u0631\u0627\u0628\u0639",
273
+ 5: "\u0627\u0644\u062E\u0627\u0645\u0633",
274
+ 6: "\u0627\u0644\u0633\u0627\u062F\u0633",
275
+ 7: "\u0627\u0644\u0633\u0627\u0628\u0639",
276
+ 8: "\u0627\u0644\u062B\u0627\u0645\u0646",
277
+ 9: "\u0627\u0644\u062A\u0627\u0633\u0639",
278
+ 10: "\u0627\u0644\u0639\u0627\u0634\u0631",
279
+ 11: "\u0627\u0644\u062D\u0627\u062F\u064A \u0639\u0634\u0631",
280
+ 12: "\u0627\u0644\u062B\u0627\u0646\u064A \u0639\u0634\u0631",
281
+ 13: "\u0627\u0644\u062B\u0627\u0644\u062B \u0639\u0634\u0631"
282
+ };
283
+ return map[abs] || abs.toString();
284
+ }
285
+ };
286
+ var he = {
287
+ weekdayNames: ["\u05D9\u05D5\u05DD \u05E9\u05E0\u05D9", "\u05D9\u05D5\u05DD \u05E9\u05DC\u05D9\u05E9\u05D9", "\u05D9\u05D5\u05DD \u05E8\u05D1\u05D9\u05E2\u05D9", "\u05D9\u05D5\u05DD \u05D7\u05DE\u05D9\u05E9\u05D9", "\u05D9\u05D5\u05DD \u05E9\u05D9\u05E9\u05D9", "\u05D9\u05D5\u05DD \u05E9\u05D1\u05EA", "\u05D9\u05D5\u05DD \u05E8\u05D0\u05E9\u05D5\u05DF"],
288
+ monthNames: [
289
+ "\u05D9\u05E0\u05D5\u05D0\u05E8",
290
+ "\u05E4\u05D1\u05E8\u05D5\u05D0\u05E8",
291
+ "\u05DE\u05E8\u05E5",
292
+ "\u05D0\u05E4\u05E8\u05D9\u05DC",
293
+ "\u05DE\u05D0\u05D9",
294
+ "\u05D9\u05D5\u05E0\u05D9",
295
+ "\u05D9\u05D5\u05DC\u05D9",
296
+ "\u05D0\u05D5\u05D2\u05D5\u05E1\u05D8",
297
+ "\u05E1\u05E4\u05D8\u05DE\u05D1\u05E8",
298
+ "\u05D0\u05D5\u05E7\u05D8\u05D5\u05D1\u05E8",
299
+ "\u05E0\u05D5\u05D1\u05DE\u05D1\u05E8",
300
+ "\u05D3\u05E6\u05DE\u05D1\u05E8"
301
+ ],
302
+ units: {
303
+ year: { singular: "\u05E9\u05E0\u05D4", plural: "\u05E9\u05E0\u05D9\u05DD" },
304
+ month: { singular: "\u05D7\u05D5\u05D3\u05E9", plural: "\u05D7\u05D5\u05D3\u05E9\u05D9\u05DD" },
305
+ week: { singular: "\u05E9\u05D1\u05D5\u05E2", plural: "\u05E9\u05D1\u05D5\u05E2\u05D5\u05EA" },
306
+ day: { singular: "\u05D9\u05D5\u05DD", plural: "\u05D9\u05DE\u05D9\u05DD" },
307
+ hour: { singular: "\u05E9\u05E2\u05D4", plural: "\u05E9\u05E2\u05D5\u05EA" },
308
+ minute: { singular: "\u05D3\u05E7\u05D4", plural: "\u05D3\u05E7\u05D5\u05EA" },
309
+ second: { singular: "\u05E9\u05E0\u05D9\u05D4", plural: "\u05E9\u05E0\u05D9\u05D5\u05EA" }
310
+ },
311
+ words: {
312
+ every: "\u05DB\u05DC",
313
+ weekday: "\u05D9\u05D5\u05DD \u05D7\u05D5\u05DC",
314
+ on: "\u05D1",
315
+ in: "\u05D1",
316
+ on_the: "\u05D1",
317
+ day_of_month: "\u05D9\u05D5\u05DD \u05D1\u05D7\u05D5\u05D3\u05E9",
318
+ day_of_year: "\u05D9\u05D5\u05DD \u05D1\u05E9\u05E0\u05D4",
319
+ in_week: "\u05D1\u05E9\u05D1\u05D5\u05E2",
320
+ at: "\u05D1\u05E9\u05E2\u05D4",
321
+ at_minute: "\u05D1\u05D3\u05E7\u05D4",
322
+ at_second: "\u05D1\u05E9\u05E0\u05D9\u05D4",
323
+ until: "\u05E2\u05D3",
324
+ for: "\u05D1\u05DE\u05E9\u05DA",
325
+ time: "\u05E4\u05E2\u05DD",
326
+ times: "\u05E4\u05E2\u05DE\u05D9\u05DD",
327
+ instance: "\u05E4\u05E2\u05DD",
328
+ week_starts_on: "\u05E9\u05D1\u05D5\u05E2 \u05DE\u05EA\u05D7\u05D9\u05DC \u05D1",
329
+ with: "\u05E2\u05DD",
330
+ additional_date: "\u05EA\u05D0\u05E8\u05D9\u05DA \u05E0\u05D5\u05E1\u05E3",
331
+ additional_dates: "\u05EA\u05D0\u05E8\u05D9\u05DB\u05D9\u05DD \u05E0\u05D5\u05E1\u05E4\u05D9\u05DD",
332
+ excluding: "\u05DC\u05DE\u05E2\u05D8",
333
+ date: "\u05EA\u05D0\u05E8\u05D9\u05DA",
334
+ dates: "\u05EA\u05D0\u05E8\u05D9\u05DB\u05D9\u05DD",
335
+ and: "\u05D5",
336
+ last: "\u05D0\u05D7\u05E8\u05D5\u05DF"
337
+ },
338
+ ordinal: (n) => {
339
+ if (n < 0) return "\u05D0\u05D7\u05E8\u05D5\u05DF";
340
+ const abs = Math.abs(n);
341
+ const map = {
342
+ 1: "\u05E8\u05D0\u05E9\u05D5\u05DF",
343
+ 2: "\u05E9\u05E0\u05D9",
344
+ 3: "\u05E9\u05DC\u05D9\u05E9\u05D9",
345
+ 4: "\u05E8\u05D1\u05D9\u05E2\u05D9",
346
+ 5: "\u05D7\u05DE\u05D9\u05E9\u05D9",
347
+ 6: "\u05E9\u05D9\u05E9\u05D9",
348
+ 7: "\u05E9\u05D1\u05D9\u05E2\u05D9",
349
+ 8: "\u05E9\u05DE\u05D9\u05E0\u05D9",
350
+ 9: "\u05EA\u05E9\u05D9\u05E2\u05D9",
351
+ 10: "\u05E2\u05E9\u05D9\u05E8\u05D9",
352
+ 11: "\u05D0\u05D7\u05D3 \u05E2\u05E9\u05E8",
353
+ 12: "\u05E9\u05E0\u05D9\u05DD \u05E2\u05E9\u05E8",
354
+ 13: "\u05E9\u05DC\u05D5\u05E9\u05D4 \u05E2\u05E9\u05E8"
355
+ };
356
+ return map[abs] || abs.toString();
357
+ }
358
+ };
359
+ var zh = {
360
+ weekdayNames: ["\u661F\u671F\u4E00", "\u661F\u671F\u4E8C", "\u661F\u671F\u4E09", "\u661F\u671F\u56DB", "\u661F\u671F\u4E94", "\u661F\u671F\u516D", "\u661F\u671F\u65E5"],
361
+ monthNames: ["\u4E00\u6708", "\u4E8C\u6708", "\u4E09\u6708", "\u56DB\u6708", "\u4E94\u6708", "\u516D\u6708", "\u4E03\u6708", "\u516B\u6708", "\u4E5D\u6708", "\u5341\u6708", "\u5341\u4E00\u6708", "\u5341\u4E8C\u6708"],
362
+ units: {
363
+ year: { singular: "\u5E74", plural: "\u5E74" },
364
+ month: { singular: "\u6708", plural: "\u6708" },
365
+ week: { singular: "\u5468", plural: "\u5468" },
366
+ day: { singular: "\u65E5", plural: "\u65E5" },
367
+ hour: { singular: "\u5C0F\u65F6", plural: "\u5C0F\u65F6" },
368
+ minute: { singular: "\u5206\u949F", plural: "\u5206\u949F" },
369
+ second: { singular: "\u79D2", plural: "\u79D2" }
370
+ },
371
+ words: {
372
+ every: "\u6BCF",
373
+ weekday: "\u5DE5\u4F5C\u65E5",
374
+ on: "\u5728",
375
+ in: "\u5728",
376
+ on_the: "\u5728",
377
+ day_of_month: "\u6708\u7684\u65E5\u5B50",
378
+ day_of_year: "\u5E74\u7684\u65E5\u5B50",
379
+ in_week: "\u7B2C",
380
+ at: "\u5728",
381
+ at_minute: "\u5728\u7B2C",
382
+ at_second: "\u5728\u7B2C",
383
+ until: "\u76F4\u5230",
384
+ for: "\u5171",
385
+ time: "\u6B21",
386
+ times: "\u6B21",
387
+ instance: "\u6B21",
388
+ week_starts_on: "\u661F\u671F\u5F00\u59CB\u4E8E",
389
+ with: "\u5E26\u6709",
390
+ additional_date: "\u989D\u5916\u65E5\u671F",
391
+ additional_dates: "\u989D\u5916\u65E5\u671F",
392
+ excluding: "\u6392\u9664",
393
+ date: "\u65E5\u671F",
394
+ dates: "\u65E5\u671F",
395
+ and: "\u548C",
396
+ last: "\u6700\u540E"
397
+ },
398
+ ordinal: (n) => n < 0 ? "\u6700\u540E" : `\u7B2C${Math.abs(n)}`
399
+ };
400
+ var ALL_LOCALES = { en, es, hi, yue, ar, he, zh };
32
401
  var env = process.env.TOTEXT_LANGS;
33
402
  var active = env ? env.split(",").map((s) => s.trim()).filter(Boolean) : Object.keys(ALL_LOCALES);
34
403
  var LOCALES = {};
35
404
  for (const l of active) {
36
405
  if (ALL_LOCALES[l]) LOCALES[l] = ALL_LOCALES[l];
37
406
  }
38
- function ordinal(n) {
407
+ function defaultOrdinal(n) {
39
408
  const abs = Math.abs(n);
40
409
  const suffix = abs % 10 === 1 && abs % 100 !== 11 ? "st" : abs % 10 === 2 && abs % 100 !== 12 ? "nd" : abs % 10 === 3 && abs % 100 !== 13 ? "rd" : "th";
41
410
  return n < 0 ? `last` : `${abs}${suffix}`;
42
411
  }
43
- function list(arr, mapFn = (x) => `${x}`, final = "and") {
412
+ function ordinal(n, locale) {
413
+ return locale.ordinal ? locale.ordinal(n) : defaultOrdinal(n);
414
+ }
415
+ function list(arr, mapFn = (x) => `${x}`, final) {
44
416
  const mapped = arr.map(mapFn);
45
417
  if (mapped.length === 1) return mapped[0];
46
418
  return mapped.slice(0, -1).join(", ") + ` ${final} ` + mapped[mapped.length - 1];
@@ -62,8 +434,8 @@ function formatByDayToken(tok, locale) {
62
434
  const idx = weekdayMap[m[2]];
63
435
  const name = locale.weekdayNames[idx];
64
436
  if (ord === 0) return name;
65
- if (ord === -1) return `last ${name}`;
66
- return `${ordinal(ord)} ${name}`;
437
+ if (ord === -1) return `${locale.words.last} ${name}`;
438
+ return `${ordinal(ord, locale)} ${name}`;
67
439
  }
68
440
  function formatTime(hour, minute = 0, second = 0) {
69
441
  const hr12 = (hour + 11) % 12 + 1;
@@ -85,12 +457,12 @@ function tzAbbreviation(zdt) {
85
457
  hour: "numeric"
86
458
  }).formatToParts(new Date(zdt.epochMilliseconds));
87
459
  const tzPart = parts.find((p) => p.type === "timeZoneName");
88
- return tzPart?.value || zdt.timeZoneId;
460
+ return (tzPart == null ? void 0 : tzPart.value) || zdt.timeZoneId;
89
461
  }
90
462
  function toText(input, locale) {
91
463
  const rule = typeof input === "string" ? new RRuleTemporal({ rruleString: input }) : input;
92
464
  const opts = rule.options();
93
- const lang = (locale ?? Intl.DateTimeFormat().resolvedOptions().locale).split("-")[0];
465
+ const lang = (locale != null ? locale : Intl.DateTimeFormat().resolvedOptions().locale).split("-")[0];
94
466
  const data = LOCALES[lang] || en;
95
467
  const {
96
468
  freq,
@@ -110,8 +482,8 @@ function toText(input, locale) {
110
482
  rDate,
111
483
  exDate
112
484
  } = opts;
113
- const parts = ["every"];
114
- const base = {
485
+ const parts = [data.words.every];
486
+ const baseKey = {
115
487
  YEARLY: "year",
116
488
  MONTHLY: "month",
117
489
  WEEKLY: "week",
@@ -120,70 +492,97 @@ function toText(input, locale) {
120
492
  MINUTELY: "minute",
121
493
  SECONDLY: "second"
122
494
  }[freq];
123
- const daysNormalized = byDay?.map((d) => d.toUpperCase());
495
+ const base = data.units[baseKey];
496
+ const daysNormalized = byDay == null ? void 0 : byDay.map((d) => d.toUpperCase());
124
497
  const isWeekdays = daysNormalized && daysNormalized.length === 5 && ["MO", "TU", "WE", "TH", "FR"].every((d) => daysNormalized.includes(d));
125
498
  const isEveryday = daysNormalized && daysNormalized.length === 7 && ["MO", "TU", "WE", "TH", "FR", "SA", "SU"].every((d) => daysNormalized.includes(d));
126
499
  if (freq === "WEEKLY" && interval === 1 && isWeekdays) {
127
- parts.push("weekday");
500
+ parts.push(data.words.weekday);
128
501
  } else if (freq === "WEEKLY" && interval === 1 && isEveryday) {
129
- parts.push("day");
502
+ parts.push(data.units.day.singular);
130
503
  } else {
131
504
  if (interval !== 1) {
132
- parts.push(interval.toString(), base + "s");
505
+ parts.push(interval.toString(), base.plural);
133
506
  } else {
134
- parts.push(base);
507
+ parts.push(base.singular);
135
508
  }
136
509
  }
137
510
  if (freq === "WEEKLY" && byDay && !isWeekdays && !isEveryday) {
138
- parts.push("on", list(byDay, (t) => formatByDayToken(t, data)));
511
+ parts.push(
512
+ data.words.on,
513
+ list(byDay, (t) => formatByDayToken(t, data), data.words.and)
514
+ );
139
515
  } else if (byDay && freq !== "WEEKLY") {
140
- parts.push("on", list(byDay, (t) => formatByDayToken(t, data)));
516
+ parts.push(
517
+ data.words.on,
518
+ list(byDay, (t) => formatByDayToken(t, data), data.words.and)
519
+ );
141
520
  }
142
521
  if (byMonth) {
143
- parts.push("in", list(byMonth, (m) => data.monthNames[m - 1]));
522
+ parts.push(
523
+ data.words.in,
524
+ list(byMonth, (m) => data.monthNames[m - 1], data.words.and)
525
+ );
144
526
  }
145
527
  if (byMonthDay) {
146
- parts.push("on the", list(byMonthDay, (d) => ordinal(d)), "day of the month");
528
+ parts.push(
529
+ data.words.on_the,
530
+ list(byMonthDay, (d) => ordinal(d, data), data.words.and),
531
+ data.words.day_of_month
532
+ );
147
533
  }
148
534
  if (byYearDay) {
149
- parts.push("on the", list(byYearDay, (d) => ordinal(d)), "day of the year");
535
+ parts.push(
536
+ data.words.on_the,
537
+ list(byYearDay, (d) => ordinal(d, data), data.words.and),
538
+ data.words.day_of_year
539
+ );
150
540
  }
151
541
  if (byWeekNo) {
152
- parts.push("in week", list(byWeekNo, (n) => n.toString()));
542
+ parts.push(
543
+ data.words.in_week,
544
+ list(byWeekNo, (n) => n.toString(), data.words.and)
545
+ );
153
546
  }
154
547
  if (byHour) {
155
- const minutes = byMinute ?? [0];
156
- const seconds = bySecond ?? [0];
157
- const times = byHour.flatMap(
158
- (h) => minutes.flatMap((m) => seconds.map((s) => formatTime(h, m, s)))
159
- );
160
- parts.push("at", list(times));
548
+ const minutes = byMinute != null ? byMinute : [0];
549
+ const seconds = bySecond != null ? bySecond : [0];
550
+ const times = byHour.flatMap((h) => minutes.flatMap((m) => seconds.map((s) => formatTime(h, m, s))));
551
+ parts.push(data.words.at, list(times, void 0, data.words.and));
161
552
  parts.push(tzAbbreviation(opts.dtstart));
162
553
  }
163
554
  if (!byHour && byMinute) {
164
- parts.push("at minute", list(byMinute));
555
+ parts.push(data.words.at_minute, list(byMinute, void 0, data.words.and));
165
556
  }
166
557
  if (!byHour && !byMinute && bySecond) {
167
- parts.push("at second", list(bySecond));
558
+ parts.push(data.words.at_second, list(bySecond, void 0, data.words.and));
168
559
  }
169
560
  if (until) {
170
561
  const monthName = data.monthNames[until.month - 1];
171
- parts.push("until", `${monthName} ${until.day}, ${until.year}`);
562
+ parts.push(data.words.until, `${monthName} ${until.day}, ${until.year}`);
172
563
  } else if (count !== void 0) {
173
- parts.push("for", count.toString(), count === 1 ? "time" : "times");
564
+ parts.push(data.words.for, count.toString(), count === 1 ? data.words.time : data.words.times);
174
565
  }
175
566
  if (bySetPos) {
176
- parts.push("on the", list(bySetPos, (n) => ordinal(n)), "instance");
567
+ parts.push(
568
+ data.words.on_the,
569
+ list(bySetPos, (n) => ordinal(n, data), data.words.and),
570
+ data.words.instance
571
+ );
177
572
  }
178
573
  if (wkst) {
179
574
  const wkName = formatByDayToken(wkst, data);
180
- parts.push("week starts on", wkName);
575
+ parts.push(data.words.week_starts_on, wkName);
181
576
  }
182
577
  if (rDate && rDate.length) {
183
- parts.push("with", `${rDate.length}`, rDate.length === 1 ? "additional date" : "additional dates");
578
+ parts.push(
579
+ data.words.with,
580
+ `${rDate.length}`,
581
+ rDate.length === 1 ? data.words.additional_date : data.words.additional_dates
582
+ );
184
583
  }
185
584
  if (exDate && exDate.length) {
186
- parts.push("excluding", `${exDate.length}`, exDate.length === 1 ? "date" : "dates");
585
+ parts.push(data.words.excluding, `${exDate.length}`, exDate.length === 1 ? data.words.date : data.words.dates);
187
586
  }
188
587
  return parts.join(" ");
189
588
  }
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "rrule-temporal",
3
- "version": "1.0.0",
3
+ "version": "1.1.1",
4
4
  "description": "Recurrence rule processing using Temporal PlainDate/PlainDateTime",
5
5
  "types": "dist/index.d.ts",
6
+ "main": "dist/index.js",
6
7
  "type": "module",
7
8
  "exports": {
8
9
  ".": {
@@ -20,7 +21,7 @@
20
21
  "build": "tsup",
21
22
  "test": "jest --coverage=false",
22
23
  "coverage": "jest",
23
- "format": "./node_modules/.bin/prettier --write 'src/tests/{rrule,edge-cases}.test.ts'",
24
+ "format": "./node_modules/.bin/prettier --write 'src/**/*.ts'",
24
25
  "prepare": "npm run build"
25
26
  },
26
27
  "repository": {