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.
@@ -1311,13 +1311,16 @@ async function openMeteoForecasts(station, fromDate, toDate, opts = {}) {
1311
1311
  const params = new URLSearchParams();
1312
1312
  params.set("latitude", String(lat));
1313
1313
  params.set("longitude", String(lon));
1314
- params.set("start_date", fromDate);
1315
- params.set("end_date", toDate);
1316
1314
  params.set("hourly", buildHourlyParam(endpoint));
1317
1315
  params.set("models", model);
1318
1316
  params.set("timezone", "UTC");
1319
- if (endpoint === OPEN_METEO_SINGLE_RUNS_URL && opts.issuedAt) {
1320
- params.set("run", opts.issuedAt);
1317
+ if (endpoint === OPEN_METEO_SINGLE_RUNS_URL) {
1318
+ if (opts.issuedAt) {
1319
+ params.set("run", opts.issuedAt);
1320
+ }
1321
+ } else {
1322
+ params.set("start_date", fromDate);
1323
+ params.set("end_date", toDate);
1321
1324
  }
1322
1325
  const fetchFn = opts.fetchFn ?? fetch;
1323
1326
  const url = `${endpoint}?${params.toString()}`;
@@ -1394,6 +1397,14 @@ async function openMeteoForecasts(station, fromDate, toDate, opts = {}) {
1394
1397
  retrievedAt
1395
1398
  });
1396
1399
  }
1400
+ if (source === "open_meteo.single_run" && rows.length > 0) {
1401
+ const loMs = Date.parse(`${fromDate}T00:00:00Z`);
1402
+ const hiMs = Date.parse(`${toDate}T00:00:00Z`) + 864e5;
1403
+ return rows.filter((r) => {
1404
+ const v = Date.parse(r.validAt);
1405
+ return v >= loMs && v < hiMs;
1406
+ });
1407
+ }
1397
1408
  return rows;
1398
1409
  }
1399
1410