feat: canvas to echarts #5
@@ -164,6 +164,7 @@ export interface WeekForecastParams extends WeatherLocation, WeatherUnitParams {
|
||||
model?: string;
|
||||
forecast_days?: number;
|
||||
past_days?: number;
|
||||
timezone?: string;
|
||||
}
|
||||
|
||||
export interface WeekHourlyData {
|
||||
@@ -285,7 +286,7 @@ const WEEK_DAILY_VARS = [
|
||||
*/
|
||||
export async function fetchWeekForecast(params: WeekForecastParams): Promise<WeekForecastResult> {
|
||||
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 apiParams: Record<string, string | number | undefined> = {
|
||||
@@ -298,7 +299,8 @@ export async function fetchWeekForecast(params: WeekForecastParams): Promise<Wee
|
||||
precipitation_unit: params.precipitation_unit ?? 'mm',
|
||||
forecast_days: forecastDays,
|
||||
past_days: pastDays,
|
||||
models: modelParam
|
||||
models: modelParam,
|
||||
timezone: params.timezone
|
||||
};
|
||||
|
||||
// Remove undefined values
|
||||
|
||||
@@ -82,7 +82,7 @@
|
||||
wind_speed_unit: params.wind_speed_unit as 'kmh' | 'ms' | 'mph' | 'kn',
|
||||
precipitation_unit: params.precipitation_unit as 'mm' | 'inch',
|
||||
forecast_days: 7,
|
||||
past_days: 1
|
||||
past_days: 0
|
||||
});
|
||||
|
||||
fetchedHourly = {
|
||||
|
||||
Reference in New Issue
Block a user