mostlyright 1.5.0 → 1.5.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.
@@ -4488,13 +4488,16 @@ var mostlyright = (() => {
4488
4488
  const params = new URLSearchParams();
4489
4489
  params.set("latitude", String(lat));
4490
4490
  params.set("longitude", String(lon));
4491
- params.set("start_date", fromDate);
4492
- params.set("end_date", toDate);
4493
4491
  params.set("hourly", buildHourlyParam(endpoint));
4494
4492
  params.set("models", model);
4495
4493
  params.set("timezone", "UTC");
4496
- if (endpoint === OPEN_METEO_SINGLE_RUNS_URL && opts.issuedAt) {
4497
- params.set("run", opts.issuedAt);
4494
+ if (endpoint === OPEN_METEO_SINGLE_RUNS_URL) {
4495
+ if (opts.issuedAt) {
4496
+ params.set("run", opts.issuedAt);
4497
+ }
4498
+ } else {
4499
+ params.set("start_date", fromDate);
4500
+ params.set("end_date", toDate);
4498
4501
  }
4499
4502
  const fetchFn = opts.fetchFn ?? fetch;
4500
4503
  const url = `${endpoint}?${params.toString()}`;
@@ -4571,6 +4574,14 @@ var mostlyright = (() => {
4571
4574
  retrievedAt
4572
4575
  });
4573
4576
  }
4577
+ if (source === "open_meteo.single_run" && rows.length > 0) {
4578
+ const loMs = Date.parse(`${fromDate}T00:00:00Z`);
4579
+ const hiMs = Date.parse(`${toDate}T00:00:00Z`) + 864e5;
4580
+ return rows.filter((r) => {
4581
+ const v = Date.parse(r.validAt);
4582
+ return v >= loMs && v < hiMs;
4583
+ });
4584
+ }
4574
4585
  return rows;
4575
4586
  }
4576
4587