no last day as default and prepare timezone

This commit is contained in:
terraputix
2026-02-16 00:30:50 +01:00
parent da9b58c1bb
commit d0c4dde794
2 changed files with 5 additions and 3 deletions
+4 -2
View File
@@ -164,6 +164,7 @@ export interface WeekForecastParams extends WeatherLocation, WeatherUnitParams {
model?: string; model?: string;
forecast_days?: number; forecast_days?: number;
past_days?: number; past_days?: number;
timezone?: string;
} }
export interface WeekHourlyData { export interface WeekHourlyData {
@@ -285,7 +286,7 @@ const WEEK_DAILY_VARS = [
*/ */
export async function fetchWeekForecast(params: WeekForecastParams): Promise<WeekForecastResult> { export async function fetchWeekForecast(params: WeekForecastParams): Promise<WeekForecastResult> {
const forecastDays = params.forecast_days ?? 6; const forecastDays = params.forecast_days ?? 6;
const pastDays = params.past_days ?? 1; const pastDays = params.past_days ?? 0;
const modelParam = params.model && params.model !== 'best_match' ? params.model : undefined; const modelParam = params.model && params.model !== 'best_match' ? params.model : undefined;
const apiParams: Record<string, string | number | undefined> = { const apiParams: Record<string, string | number | undefined> = {
@@ -298,7 +299,8 @@ export async function fetchWeekForecast(params: WeekForecastParams): Promise<Wee
precipitation_unit: params.precipitation_unit ?? 'mm', precipitation_unit: params.precipitation_unit ?? 'mm',
forecast_days: forecastDays, forecast_days: forecastDays,
past_days: pastDays, past_days: pastDays,
models: modelParam models: modelParam,
timezone: params.timezone
}; };
// Remove undefined values // Remove undefined values
@@ -82,7 +82,7 @@
wind_speed_unit: params.wind_speed_unit as 'kmh' | 'ms' | 'mph' | 'kn', wind_speed_unit: params.wind_speed_unit as 'kmh' | 'ms' | 'mph' | 'kn',
precipitation_unit: params.precipitation_unit as 'mm' | 'inch', precipitation_unit: params.precipitation_unit as 'mm' | 'inch',
forecast_days: 7, forecast_days: 7,
past_days: 1 past_days: 0
}); });
fetchedHourly = { fetchedHourly = {