avwx-rest / avwx-api

REST API for parsing aviation weather data
https://avwx.rest
MIT License
71 stars 89 forks source link

TAF - Different time formats #22

Closed pejeio closed 4 years ago

pejeio commented 4 years ago

Expectation

start_time.dt and end_time.dt is always formatted in the correct ISO 8601 format

Result

The format differs from location to location.

EBBR

https://avwx.rest/api/taf/EBBR

Raw TAF: EBBR 050501Z 0506/0612 06011KT CAVOK

"start_time": {
  "repr": "0506",
  "dt": "2020-05-05T06:00:00+00:00Z"
}

ELLX

https://avwx.rest/api/taf/ELLX

Raw TAF: ELLX 050500Z 0506/0612 04010KT CAVOK

"start_time": {
  "repr": "0506",
  "dt": "2020-05-05T06:00:00Z"
}

It becomes especially difficult when this time has to be parsed for different weather stations. Tools like Moment.js fail.

Furthermore, the notation for EBBR does not appear to be correct. The letter "Z" should never be added when using "+00:00".

Schermafbeelding 2020-05-05 om 08 20 11
devdupont commented 4 years ago

I will need to add some more tests in the core library to figure out what is causing some date time objects to be created without a timezone, but I've made a change to the JSON formatter that should fix this problem's symptom for the end-user.

https://github.com/avwx-rest/avwx-api-core/commit/779cffd4826e43d12c0bf1e0fb43dca5d43c361a