CodingNic

Build the Forecast

Format Forecast Dates

Build the Forecast 10 min read

Format Forecast Dates

Task

Show a friendly day/date instead of timestamps.

File / section

src/components/Forecast.jsx and src/utils/weather.js

Change

Use dateParts(midday.dt, data.city.timezone) and render Today for the first card, otherwise p.day, with p.date below it.

Why this change matters

dateParts applies the city timezone offset before formatting, keeping the display aligned with the selected location.

Test it

Search a city and confirm each forecast card has a readable day and date.

Checkpoint

Forecast dates are human-readable and location-aware.