@idm-plugin/meteo2 1.0.1 → 1.0.3

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.js CHANGED
@@ -1534,7 +1534,7 @@ class Q {
1534
1534
  } else if (!z.start_date && !z.end_date) {
1535
1535
  const X = this.pickForecastUrl(!1, c.selfHosted, !1, c);
1536
1536
  return await this.tryToFetchWeatherApi(X, z, b, 0, c);
1537
- } else if (Y != null && Y.isBefore(n.clone().subtract(240))) {
1537
+ } else if (Y != null && Y.isBefore(n.clone().subtract(240, "day"))) {
1538
1538
  const X = this.pickForecastUrl(!1, !1, !0, c);
1539
1539
  return await this.tryToFetchWeatherApi(X, z, b, 0, c);
1540
1540
  } else if (O != null && O.isAfter(n.clone().add(90, "day"))) {
@@ -1569,7 +1569,7 @@ class Q {
1569
1569
  const O = await t0(z, b), Y = p ? await p(O, b, A) : await this.parseWeatherData(O, b, W, A);
1570
1570
  delete b.apikey;
1571
1571
  const a = i();
1572
- return this.debug && _.info("[%s] fetch weather api (%j) cost: %d ms", A.requestId, b.url, a.diff(c, "ms")), this.mergeWeatherData(Y);
1572
+ return this.debug && _.info("[%s] fetch weather api (%s) cost: %d ms", A.requestId, b.url, a.diff(c, "ms")), this.mergeWeatherData(Y);
1573
1573
  } catch (c) {
1574
1574
  throw _.warn("[%s] weather forecast failed: %s, with %j", A.requestId, c, b), c;
1575
1575
  }
@@ -1599,7 +1599,7 @@ class Q {
1599
1599
  } else
1600
1600
  for (const f of z.models)
1601
1601
  try {
1602
- if (W != null && W.isBefore(c.clone().subtract(240))) {
1602
+ if (W != null && W.isBefore(c.clone().subtract(240, "day"))) {
1603
1603
  const U = this.pickForecastUrl(!0, !1, !0, b), P = await this.tryToFetchMarineApi(U, { ...z, models: [f] }, b);
1604
1604
  O.push(...P);
1605
1605
  } else if (p != null && p.isAfter(c.clone().add(90, "day"))) {
@@ -1631,7 +1631,7 @@ class Q {
1631
1631
  const W = i();
1632
1632
  this.debug && _.info("[%s] fetch marine via %s with %j", p.requestId, z, b);
1633
1633
  const A = await t0(z, b), c = i();
1634
- return this.debug && _.info("[%s] fetch weather api (%j) cost: %d ms", p.requestId, b.url, c.diff(W, "ms")), A;
1634
+ return this.debug && _.info("[%s] fetch weather api (%s) cost: %d ms", p.requestId, b.url, c.diff(W, "ms")), A;
1635
1635
  } catch (W) {
1636
1636
  throw _.warn("[%s] marine forecast failed: %s, with %j", p.requestId, W, b), W;
1637
1637
  }