no last day as default and prepare timezone
This commit is contained in:
@@ -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 = {
|
||||||
|
|||||||
Reference in New Issue
Block a user