Hi there
Have been playing around with WeatherKit however seem to be running into an odd issue with the timedate not showing accurately.
Example is below. I requested this data below at 2:36pm on the 3rd Jan 2023. However in the "asOf" key value pair below it shows the timedate "2023-01-03T03:36:47Z" which to me is saying that the current conditions shown are as of 3:36am on the 3rd Jan 2023. The readtime key pair (in the metadata part) also presents the same thing.
"currentWeather": { "name": "CurrentWeather", "metadata": { "attributionURL": "https://weatherkit.apple.com/legal-attribution.html", "expireTime": "2023-01-03T03:41:47Z", "latitude": -35.307, "longitude": 149.194, "readTime": "2023-01-03T03:36:47Z", "reportedTime": "2023-01-03T02:00:00Z", "units": "m", "version": 1 }, "asOf": "2023-01-03T03:36:47Z", "cloudCover": 0.40, "conditionCode": "PartlyCloudy", "daylight": true, "humidity": 0.40, "precipitationIntensity": 0.0, "pressure": 1002.20, "pressureTrend": "falling", "temperature": 31.89, "temperatureApparent": 32.79, "temperatureDewPoint": 16.80, "uvIndex": 9, "visibility": 26772.50, "windDirection": 324, "windGust": 30.04, "windSpeed": 12.50 }
My request URL is below along with the correct bearer authorization tag to grab the data. Lat/Long indicate the city of Canberra, Australia. Timezone set to Australia/Canberra
https://weatherkit.apple.com/api/v1/weather/en_AU/-35.306524/149.193550?timeZone=Australia/Canberra&countryCode=AU&dataSets=currentWeather,forecastDaily,forecastHourly
Is the behaviour I am experiencing standard or would this be some sort of bug..
That looks correct. All those timestamps are in UTC (note the “Z” at the end, which means UTC) so they should be 11 hours behind your local time. If presenting them in your user interface, you’ll need to use a date formatter with the time zone set correctly.
You did specify your local time zone in the request URL, but the API doc says that’s for determining day boundaries for daily forecasts. Looks like all timestamps in responses will still be in UTC.