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

Date #27

Open
ZecaStevenson opened this issue Mar 21, 2022 · 0 comments
Open

Date #27

ZecaStevenson opened this issue Mar 21, 2022 · 0 comments

Comments

@ZecaStevenson
Copy link

If you pass the exact sam METAR a couple of time, the resulting object will have a different "time" attribute each time:
https://skydivejkl.github.io/metar.js/#SBSP%20210000Z%2014006KT%209999%20-RA%20BKN007%20OVC013%2017/16%20Q1023

SBSP 210000Z 14006KT 9999 -RA BKN007 OVC013 17/16 Q1023
1st call: 2022-03-21T00:00:01.762Z
2ns call: 2022-03-21T00:00:34.040Z
3rd call: 2022-03-21T00:00:50.418Z

The problem seem to be here:
METAR.prototype.parseDate = function() {
this.next();
var d = new Date();
d.setUTCDate(asInt(this.current.slice(0, 2)));
d.setUTCHours(asInt(this.current.slice(2, 4)));
d.setUTCMinutes(asInt(this.current.slice(4, 6)));
this.result.time = d;
};

Also, I'm not sure if the METAR timezone is being taken into account. In this example SBSP is the São Paulo–Congonhas Airport which is in GMT-3.

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