Add a sun cream tip for hot days (high > 26°C)
Temp-based stand-in for the UV-index idea from earlier -- neither provider is currently fetched for UV, so this reuses the same highTemp value already computed for the jacket tip, just the other direction. Mutually exclusive with jacket (a high can't be both <12 and >26). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
b4f1e81eed
commit
e355d48da4
3 changed files with 10 additions and 3 deletions
|
|
@ -14,6 +14,9 @@ const SNOW_ICONS = new Set(['snow-light', 'snow-heavy'])
|
|||
// without touching the logic that uses them.
|
||||
const UMBRELLA_SOFT_PRECIP_PCT = 10 // any remaining hour above this -> "might want"
|
||||
const JACKET_HIGH_TEMP_C = 12 // today's forecast high below this -> jacket tip
|
||||
const SUN_HIGH_TEMP_C = 26 // today's forecast high above this -> sun cream tip
|
||||
// (a temp-based stand-in for a proper UV index,
|
||||
// which neither provider is currently fetched for)
|
||||
|
||||
// summarizeToday(points, nowHour) — `points` is today's hourly forecast_points rows
|
||||
// (already icon-normalized), `nowHour` is 0-23 in Europe/London. Returns null if
|
||||
|
|
@ -97,9 +100,12 @@ export function summarizeToday(points, nowHour) {
|
|||
}
|
||||
|
||||
// Jacket: keyed off today's forecast high, not "right now" -- same framing
|
||||
// as the big temp above it.
|
||||
// as the big temp above it. Mutually exclusive with the sun tip below (never
|
||||
// both -- one high temp can't be both below 12 and above 26).
|
||||
if (highPoint.temp_c < JACKET_HIGH_TEMP_C) {
|
||||
tips.push({ key: 'jacket', text: "Don't forget your jacket" })
|
||||
} else if (highPoint.temp_c > SUN_HIGH_TEMP_C) {
|
||||
tips.push({ key: 'sun', text: "Don't forget your sun cream" })
|
||||
}
|
||||
|
||||
return {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue