diff --git a/packages/old-import/src/widgets/options.ts b/packages/old-import/src/widgets/options.ts
index 3e2d27b4e..d8a84e95e 100644
--- a/packages/old-import/src/widgets/options.ts
+++ b/packages/old-import/src/widgets/options.ts
@@ -56,6 +56,8 @@ const optionMapping: OptionMapping = {
showSeconds: () => undefined,
timezone: (oldOptions) => oldOptions.timezone,
useCustomTimezone: () => true,
+ customTimeFormat: () => undefined,
+ customDateFormat: () => undefined,
},
downloads: {
activeTorrentThreshold: (oldOptions) =>
diff --git a/packages/translation/src/lang/en.json b/packages/translation/src/lang/en.json
index 6d45df73f..a940087c8 100644
--- a/packages/translation/src/lang/en.json
+++ b/packages/translation/src/lang/en.json
@@ -1193,6 +1193,14 @@
"dateFormat": {
"label": "Date Format",
"description": "How the date should look like"
+ },
+ "customTimeFormat": {
+ "label": "Custom time format",
+ "description": "Use ISO 8601 to format time (this will override other options)"
+ },
+ "customDateFormat": {
+ "label": "Custom date format",
+ "description": "Use ISO 8601 to format date (this will override other options)"
}
}
},
diff --git a/packages/widgets/src/clock/component.tsx b/packages/widgets/src/clock/component.tsx
index b32c5dbe1..95c5a2af2 100644
--- a/packages/widgets/src/clock/component.tsx
+++ b/packages/widgets/src/clock/component.tsx
@@ -17,6 +17,8 @@ export default function ClockWidget({ options }: WidgetComponentProps<"clock">)
const secondsFormat = options.showSeconds ? ":ss" : "";
const timeFormat = options.is24HourFormat ? `HH:mm${secondsFormat}` : `h:mm${secondsFormat} A`;
const dateFormat = options.dateFormat;
+ const customTimeFormat = options.customTimeFormat;
+ const customDateFormat = options.customDateFormat;
const timezone = options.useCustomTimezone ? options.timezone : Intl.DateTimeFormat().resolvedOptions().timeZone;
const time = useCurrentTime(options);
return (
@@ -27,11 +29,15 @@ export default function ClockWidget({ options }: WidgetComponentProps<"clock">)
)}
- {dayjs(time).tz(timezone).format(timeFormat)}
+ {options.customTimeFormat
+ ? dayjs(time).tz(timezone).format(customTimeFormat)
+ : dayjs(time).tz(timezone).format(timeFormat)}
{options.showDate && (
- {dayjs(time).tz(timezone).format(dateFormat)}
+ {options.customDateFormat
+ ? dayjs(time).tz(timezone).format(customDateFormat)
+ : dayjs(time).tz(timezone).format(dateFormat)}
)}
diff --git a/packages/widgets/src/clock/index.ts b/packages/widgets/src/clock/index.ts
index fed269b9b..47125609c 100644
--- a/packages/widgets/src/clock/index.ts
+++ b/packages/widgets/src/clock/index.ts
@@ -46,6 +46,14 @@ export const { definition, componentLoader } = createWidgetDefinition("clock", {
defaultValue: "dddd, MMMM D",
withDescription: true,
}),
+ customTimeFormat: factory.text({
+ defaultValue: "",
+ withDescription: true,
+ }),
+ customDateFormat: factory.text({
+ defaultValue: "",
+ withDescription: true,
+ }),
}),
{
customTitle: {