rrule-temporal 1.1.7 → 1.1.8

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.
@@ -1166,14 +1166,44 @@ var RRuleTemporal = class _RRuleTemporal {
1166
1166
  * @returns An array of Temporal.ZonedDateTime objects representing all occurrences of the rule within the specified time window.
1167
1167
  */
1168
1168
  between(after, before, inc = false) {
1169
+ var _a;
1169
1170
  const startInst = after instanceof Date ? Temporal.Instant.from(after.toISOString()) : after.toInstant();
1170
1171
  const endInst = before instanceof Date ? Temporal.Instant.from(before.toISOString()) : before.toInstant();
1172
+ const startZdt = Temporal.Instant.from(startInst).toZonedDateTimeISO(this.tzid);
1171
1173
  const beforeZdt = Temporal.Instant.from(endInst).toZonedDateTimeISO(this.tzid);
1172
1174
  const tempOpts = __spreadValues({}, this.opts);
1173
1175
  if (!tempOpts.until || Temporal.ZonedDateTime.compare(beforeZdt, tempOpts.until) < 0) {
1174
1176
  tempOpts.until = beforeZdt;
1175
1177
  }
1176
- delete tempOpts.count;
1178
+ if (tempOpts.count === void 0) {
1179
+ const interval = (_a = tempOpts.interval) != null ? _a : 1;
1180
+ let duration;
1181
+ switch (tempOpts.freq) {
1182
+ case "YEARLY":
1183
+ duration = { years: interval };
1184
+ break;
1185
+ case "MONTHLY":
1186
+ duration = { months: interval };
1187
+ break;
1188
+ case "WEEKLY":
1189
+ duration = { weeks: interval };
1190
+ break;
1191
+ case "DAILY":
1192
+ duration = { days: interval };
1193
+ break;
1194
+ case "HOURLY":
1195
+ duration = { hours: interval };
1196
+ break;
1197
+ case "MINUTELY":
1198
+ duration = { minutes: interval };
1199
+ break;
1200
+ default:
1201
+ duration = { seconds: interval };
1202
+ }
1203
+ const aligned = startZdt.withPlainTime(this.originalDtstart.toPlainTime());
1204
+ const candidate = aligned.subtract(duration);
1205
+ tempOpts.dtstart = Temporal.ZonedDateTime.compare(candidate, this.opts.dtstart) > 0 ? candidate : this.opts.dtstart;
1206
+ }
1177
1207
  const tempRule = new _RRuleTemporal(tempOpts);
1178
1208
  const allDates = tempRule.all();
1179
1209
  return allDates.filter((date) => {
package/dist/index.cjs CHANGED
@@ -1187,14 +1187,44 @@ var RRuleTemporal = class _RRuleTemporal {
1187
1187
  * @returns An array of Temporal.ZonedDateTime objects representing all occurrences of the rule within the specified time window.
1188
1188
  */
1189
1189
  between(after, before, inc = false) {
1190
+ var _a;
1190
1191
  const startInst = after instanceof Date ? import_polyfill.Temporal.Instant.from(after.toISOString()) : after.toInstant();
1191
1192
  const endInst = before instanceof Date ? import_polyfill.Temporal.Instant.from(before.toISOString()) : before.toInstant();
1193
+ const startZdt = import_polyfill.Temporal.Instant.from(startInst).toZonedDateTimeISO(this.tzid);
1192
1194
  const beforeZdt = import_polyfill.Temporal.Instant.from(endInst).toZonedDateTimeISO(this.tzid);
1193
1195
  const tempOpts = __spreadValues({}, this.opts);
1194
1196
  if (!tempOpts.until || import_polyfill.Temporal.ZonedDateTime.compare(beforeZdt, tempOpts.until) < 0) {
1195
1197
  tempOpts.until = beforeZdt;
1196
1198
  }
1197
- delete tempOpts.count;
1199
+ if (tempOpts.count === void 0) {
1200
+ const interval = (_a = tempOpts.interval) != null ? _a : 1;
1201
+ let duration;
1202
+ switch (tempOpts.freq) {
1203
+ case "YEARLY":
1204
+ duration = { years: interval };
1205
+ break;
1206
+ case "MONTHLY":
1207
+ duration = { months: interval };
1208
+ break;
1209
+ case "WEEKLY":
1210
+ duration = { weeks: interval };
1211
+ break;
1212
+ case "DAILY":
1213
+ duration = { days: interval };
1214
+ break;
1215
+ case "HOURLY":
1216
+ duration = { hours: interval };
1217
+ break;
1218
+ case "MINUTELY":
1219
+ duration = { minutes: interval };
1220
+ break;
1221
+ default:
1222
+ duration = { seconds: interval };
1223
+ }
1224
+ const aligned = startZdt.withPlainTime(this.originalDtstart.toPlainTime());
1225
+ const candidate = aligned.subtract(duration);
1226
+ tempOpts.dtstart = import_polyfill.Temporal.ZonedDateTime.compare(candidate, this.opts.dtstart) > 0 ? candidate : this.opts.dtstart;
1227
+ }
1198
1228
  const tempRule = new _RRuleTemporal(tempOpts);
1199
1229
  const allDates = tempRule.all();
1200
1230
  return allDates.filter((date) => {
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  RRuleTemporal
3
- } from "./chunk-KT55S4C7.js";
3
+ } from "./chunk-AVNL4A5D.js";
4
4
  export {
5
5
  RRuleTemporal
6
6
  };
package/dist/totext.cjs CHANGED
@@ -1189,14 +1189,44 @@ var RRuleTemporal = class _RRuleTemporal {
1189
1189
  * @returns An array of Temporal.ZonedDateTime objects representing all occurrences of the rule within the specified time window.
1190
1190
  */
1191
1191
  between(after, before, inc = false) {
1192
+ var _a;
1192
1193
  const startInst = after instanceof Date ? import_polyfill.Temporal.Instant.from(after.toISOString()) : after.toInstant();
1193
1194
  const endInst = before instanceof Date ? import_polyfill.Temporal.Instant.from(before.toISOString()) : before.toInstant();
1195
+ const startZdt = import_polyfill.Temporal.Instant.from(startInst).toZonedDateTimeISO(this.tzid);
1194
1196
  const beforeZdt = import_polyfill.Temporal.Instant.from(endInst).toZonedDateTimeISO(this.tzid);
1195
1197
  const tempOpts = __spreadValues({}, this.opts);
1196
1198
  if (!tempOpts.until || import_polyfill.Temporal.ZonedDateTime.compare(beforeZdt, tempOpts.until) < 0) {
1197
1199
  tempOpts.until = beforeZdt;
1198
1200
  }
1199
- delete tempOpts.count;
1201
+ if (tempOpts.count === void 0) {
1202
+ const interval = (_a = tempOpts.interval) != null ? _a : 1;
1203
+ let duration;
1204
+ switch (tempOpts.freq) {
1205
+ case "YEARLY":
1206
+ duration = { years: interval };
1207
+ break;
1208
+ case "MONTHLY":
1209
+ duration = { months: interval };
1210
+ break;
1211
+ case "WEEKLY":
1212
+ duration = { weeks: interval };
1213
+ break;
1214
+ case "DAILY":
1215
+ duration = { days: interval };
1216
+ break;
1217
+ case "HOURLY":
1218
+ duration = { hours: interval };
1219
+ break;
1220
+ case "MINUTELY":
1221
+ duration = { minutes: interval };
1222
+ break;
1223
+ default:
1224
+ duration = { seconds: interval };
1225
+ }
1226
+ const aligned = startZdt.withPlainTime(this.originalDtstart.toPlainTime());
1227
+ const candidate = aligned.subtract(duration);
1228
+ tempOpts.dtstart = import_polyfill.Temporal.ZonedDateTime.compare(candidate, this.opts.dtstart) > 0 ? candidate : this.opts.dtstart;
1229
+ }
1200
1230
  const tempRule = new _RRuleTemporal(tempOpts);
1201
1231
  const allDates = tempRule.all();
1202
1232
  return allDates.filter((date) => {
package/dist/totext.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  RRuleTemporal
3
- } from "./chunk-KT55S4C7.js";
3
+ } from "./chunk-AVNL4A5D.js";
4
4
 
5
5
  // src/totext.ts
6
6
  var en = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rrule-temporal",
3
- "version": "1.1.7",
3
+ "version": "1.1.8",
4
4
  "description": "Recurrence rule processing using Temporal PlainDate/PlainDateTime",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",