feat: default timezone to user's local timezone in activate form (#5374)

This commit is contained in:
Charles Zhou 2024-06-18 21:27:06 -05:00 committed by GitHub
parent a965d1ac98
commit 2b0c779173
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -41,10 +41,9 @@ const ActivateForm = () => {
const [name, setName] = useState('') const [name, setName] = useState('')
const [password, setPassword] = useState('') const [password, setPassword] = useState('')
const [timezone, setTimezone] = useState('Asia/Shanghai') const [timezone, setTimezone] = useState(Intl.DateTimeFormat().resolvedOptions().timeZone)
const [language, setLanguage] = useState(locale) const [language, setLanguage] = useState(locale)
const [showSuccess, setShowSuccess] = useState(false) const [showSuccess, setShowSuccess] = useState(false)
const defaultLanguage = useCallback(() => (window.navigator.language.startsWith('zh') ? LanguagesSupported[1] : LanguagesSupported[0]) || LanguagesSupported[0], [])
const showErrorMessage = useCallback((message: string) => { const showErrorMessage = useCallback((message: string) => {
Toast.notify({ Toast.notify({