feat: date format on weather widget (#1443)

* feat: date format on weather widget

* fix: type check error

* fix: reviewed changes

* fix: reviewed changes
This commit is contained in:
Yossi Hillali
2024-11-08 11:33:03 +02:00
committed by GitHub
parent aa503992af
commit c51c5db3d7
6 changed files with 45 additions and 2 deletions

View File

@@ -1,4 +1,5 @@
import { IconCloud } from "@tabler/icons-react";
import dayjs from "dayjs";
import { z } from "@homarr/validation";
@@ -17,6 +18,20 @@ export const { definition, componentLoader } = createWidgetDefinition("weather",
longitude: 2.3488,
},
}),
dateFormat: factory.select({
options: [
{ value: "dddd, MMMM D", label: dayjs().format("dddd, MMMM D") },
{ value: "dddd, D MMMM", label: dayjs().format("dddd, D MMMM") },
{ value: "MMM D", label: dayjs().format("MMM D") },
{ value: "D MMM", label: dayjs().format("D MMM") },
{ value: "DD/MM/YYYY", label: dayjs().format("DD/MM/YYYY") },
{ value: "MM/DD/YYYY", label: dayjs().format("MM/DD/YYYY") },
{ value: "DD/MM", label: dayjs().format("DD/MM") },
{ value: "MM/DD", label: dayjs().format("MM/DD") },
],
defaultValue: "dddd, MMMM D",
withDescription: true,
}),
showCity: factory.switch(),
hasForecast: factory.switch(),
forecastDayCount: factory.slider({