Three related changes to the weather widget, plus one pre-existing bug the work
exposed.
WMO code 0 was unconditionally "Clear sky" with a sun icon, so a clear night
rendered a sun at midnight. Daytime now reads "Sunny"/"Mostly sunny" and night
"Clear"/"Mostly clear" with a moon, driven by Open-Meteo's is_day rather than any
hardcoded hour, so it tracks seasonal drift, latitude and DST on its own. Partly
cloudy, drizzle and showers flip too, since their icons also draw a sun; rain, fog,
snow and thunder are identical at any hour and are left alone. The daily forecast
summarises a whole day, so wmoToCondition defaults to the daytime form.
Renaming the label broke the prose in three places that only showed up against real
cities: a dry run spanning sunset inherited the first segment's adjective and said
"sunny ... into the overnight hours"; whole-day tallies split one clear sky into
Sunny and Clear and could lose a vote to a half-cloudy day; and the "clearing"
test matched /clear/ only, so it would have said "easing off" instead.
Precipitation amounts are new. The synopsis now states the day's expected total
("Rainfall today will total around 0.2 inches"), tomorrow's clause carries its own
total, and the hourly panel shows per-hour accumulation. A precipUnit setting sits
alongside the existing wind and pressure ones; metric follows the forecasting
convention of millimetres for rain but centimetres for snow depth, which is what
Open-Meteo returns. Amounts below a trace are suppressed rather than printing
"around 0 inches". rain_sum excludes showers, so both are summed.
Separately: Open-Meteo anchors its arrays to the day the response was generated
for, which can still be yesterday in the location's own timezone shortly after
local midnight. Glasgow at 00:55 BST was served daily[0] = the previous date, so
every hour of "today" was already past, todayRemaining came out empty, and
buildDaySummary discarded the entire synopsis - current conditions and tomorrow
included. Today is now anchored on the first hour actually being shown, which also
puts today's totals and today's sunrise/sunset on the right row, and each sentence
is omitted independently rather than one gap voiding the lot.
Co-Authored-By: Claude Opus 5 <[email protected]>
sv
Everything you need to build a Svelte project, powered by sv.
Creating a project
If you're seeing this, you've probably already done this step. Congrats!
# create a new project
npx sv create my-app
To recreate this project with the same configuration:
# recreate this project
npx [email protected] create --template minimal --types ts --install npm frontend
Developing
Once you've created a project and installed dependencies with npm install (or pnpm install or yarn), start a development server:
npm run dev
# or start the server and open the app in a new browser tab
npm run dev -- --open
Building
To create a production version of your app:
npm run build
You can preview the production build with npm run preview.
To deploy your app, you may need to install an adapter for your target environment.