From 43e90d6de48e1554626f8d15e38813fc101c7c1b Mon Sep 17 00:00:00 2001
From: ZhaiSoul <842607283@qq.com>
Date: Fri, 1 May 2026 22:13:00 +0800
Subject: [PATCH] docs: timezone change to select
---
.../components/OtherOptions.tsx | 49 ++++++++++++++++---
.../hooks/useConfigGenerator.ts | 4 +-
.../DockerComposeGenerator/styles.module.css | 15 ++++++
3 files changed, 57 insertions(+), 11 deletions(-)
diff --git a/docs/src/components/DockerComposeGenerator/components/OtherOptions.tsx b/docs/src/components/DockerComposeGenerator/components/OtherOptions.tsx
index 69b3a59c1..8d1efef0f 100644
--- a/docs/src/components/DockerComposeGenerator/components/OtherOptions.tsx
+++ b/docs/src/components/DockerComposeGenerator/components/OtherOptions.tsx
@@ -1,7 +1,24 @@
-import React from "react";
+import React, { useMemo } from "react";
import CodeInline from "@theme/CodeInline";
import styles from "../styles.module.css";
+const AUTO_TIMEZONE_VALUE = "__auto__";
+
+function getTimezoneList(): string[] {
+ if (typeof Intl !== "undefined") {
+ const intl = Intl as typeof Intl & {
+ supportedValuesOf?: (key: string) => string[];
+ };
+ const supported = intl.supportedValuesOf?.("timeZone");
+ if (supported && supported.length > 0) {
+ return [...supported].sort();
+ }
+ }
+
+ const fallback = Intl.DateTimeFormat().resolvedOptions().timeZone;
+ return fallback ? [fallback] : ["UTC"];
+}
+
interface Props {
rtspPassword: string;
timezone: string;
@@ -21,6 +38,11 @@ export default function OtherOptions({
onTimezoneChange,
onShmSizeChange,
}: Props) {
+ const timezones = useMemo(() => getTimezoneList(), []);
+ const systemTimezone =
+ Intl.DateTimeFormat().resolvedOptions().timeZone || "Etc/UTC";
+ const selectedValue = timezone || AUTO_TIMEZONE_VALUE;
+
return (
Other Options
@@ -29,14 +51,25 @@ export default function OtherOptions({
- onTimezoneChange(e.target.value)}
- />
+ className={`${styles.input} ${styles.select}`}
+ value={selectedValue}
+ onChange={(e) =>
+ onTimezoneChange(
+ e.target.value === AUTO_TIMEZONE_VALUE ? "" : e.target.value
+ )
+ }
+ >
+
+ {timezones.map((tz) => (
+
+ ))}
+