rrule-temporal 0.2.6 → 0.2.7

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/index.cjs CHANGED
@@ -221,7 +221,24 @@ var RRuleTemporal = class {
221
221
  return out.sort((a, b) => import_polyfill.Temporal.ZonedDateTime.compare(a, b));
222
222
  }
223
223
  nextCandidateSameDate(zdt) {
224
- const { byHour, byMinute } = this.opts;
224
+ const { freq, interval = 1, byHour, byMinute } = this.opts;
225
+ if (freq === "HOURLY" && byHour && byHour.length === 1) {
226
+ return this.applyTimeOverride(zdt.add({ days: interval }));
227
+ }
228
+ if (freq === "MINUTELY" && byMinute && byMinute.length === 1) {
229
+ return this.applyTimeOverride(zdt.add({ hours: interval }));
230
+ }
231
+ if (freq === "SECONDLY" && byMinute && byMinute.length === 1) {
232
+ const next = zdt.add({ seconds: interval });
233
+ if (next.minute === byMinute[0]) return next;
234
+ return this.applyTimeOverride(zdt.add({ hours: interval })).with({ second: 0 });
235
+ }
236
+ if (byMinute && byMinute.length > 1) {
237
+ const idx = byMinute.indexOf(zdt.minute);
238
+ if (idx !== -1 && idx < byMinute.length - 1) {
239
+ return zdt.with({ minute: byMinute[idx + 1] });
240
+ }
241
+ }
225
242
  if (byHour && byHour.length > 1) {
226
243
  const idx = byHour.indexOf(zdt.hour);
227
244
  if (idx !== -1 && idx < byHour.length - 1) {
package/dist/index.js CHANGED
@@ -197,7 +197,24 @@ var RRuleTemporal = class {
197
197
  return out.sort((a, b) => Temporal.ZonedDateTime.compare(a, b));
198
198
  }
199
199
  nextCandidateSameDate(zdt) {
200
- const { byHour, byMinute } = this.opts;
200
+ const { freq, interval = 1, byHour, byMinute } = this.opts;
201
+ if (freq === "HOURLY" && byHour && byHour.length === 1) {
202
+ return this.applyTimeOverride(zdt.add({ days: interval }));
203
+ }
204
+ if (freq === "MINUTELY" && byMinute && byMinute.length === 1) {
205
+ return this.applyTimeOverride(zdt.add({ hours: interval }));
206
+ }
207
+ if (freq === "SECONDLY" && byMinute && byMinute.length === 1) {
208
+ const next = zdt.add({ seconds: interval });
209
+ if (next.minute === byMinute[0]) return next;
210
+ return this.applyTimeOverride(zdt.add({ hours: interval })).with({ second: 0 });
211
+ }
212
+ if (byMinute && byMinute.length > 1) {
213
+ const idx = byMinute.indexOf(zdt.minute);
214
+ if (idx !== -1 && idx < byMinute.length - 1) {
215
+ return zdt.with({ minute: byMinute[idx + 1] });
216
+ }
217
+ }
201
218
  if (byHour && byHour.length > 1) {
202
219
  const idx = byHour.indexOf(zdt.hour);
203
220
  if (idx !== -1 && idx < byHour.length - 1) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rrule-temporal",
3
- "version": "0.2.6",
3
+ "version": "0.2.7",
4
4
  "description": "Recurrence rule processing using Temporal PlainDate/PlainDateTime",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",