Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TimestampOutOfBoundsError: Provided timestamp is outside the report validity period #76

Open
satrijo opened this issue Aug 4, 2023 · 0 comments

Comments

@satrijo
Copy link

satrijo commented Aug 4, 2023

Hello I get the problem when I try to run this library in expressjs

this is my code

import Express from "express";
import { eachHourOfInterval } from "date-fns";
import {
  parseTAFAsForecast,
  getCompositeForecastForDate,
} from "metar-taf-parser";

const app = new Express();

app.get("/", (req, res) => {
  const rawTAFString =
    "TAF WIII 040500Z 0406/0512 02010KT 7000 FEW021 BECMG 0414/0416 16005KT 5000 HZ BECMG 0419/0421 3000 BR BECMG 0501/0503 07010KT 7000 NSW=";
  const issued = new Date();
  const report = parseTAFAsForecast(rawTAFString, { issued });

  const forecastPerHour = eachHourOfInterval({
    start: report.start,
    end: report.end,
  }).map((hour) => ({
    hour,
    ...getCompositeForecastForDate(hour, report),
  }));

  res.send(report);
});

app.listen(3000, () => {
  console.log("Server running on port 3000");
});

And I got this error

TimestampOutOfBoundsError: Provided timestamp is outside the report validity period
    at getCompositeForecastForDate (file:///D:/Script/express/taf-parser/node_modules/metar-taf-parser/metar-taf-parser.js:3074:15)
    at file:///D:/Script/express/taf-parser/app.js:21:8
    at Array.map (<anonymous>)
    at file:///D:/Script/express/taf-parser/app.js:19:6
    at Layer.handle [as handle_request] (D:\Script\express\taf-parser\node_modules\express\lib\router\layer.js:95:5)
    at next (D:\Script\express\taf-parser\node_modules\express\lib\router\route.js:144:13)
    at Route.dispatch (D:\Script\express\taf-parser\node_modules\express\lib\router\route.js:114:3)
    at Layer.handle [as handle_request] (D:\Script\express\taf-parser\node_modules\express\lib\router\layer.js:95:5)
    at D:\Script\express\taf-parser\node_modules\express\lib\router\index.js:284:15
    at Function.process_params (D:\Script\express\taf-parser\node_modules\express\lib\router\index.js:346:12)
@satrijo satrijo changed the title InvalidWeatherStatementError: Invalid weather string TimestampOutOfBoundsError: Provided timestamp is outside the report validity period Aug 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant