Cleanup setting of the timezone

This commit is contained in:
Nick Mowen 2023-01-13 13:53:31 -07:00
parent 19a20ab8e3
commit 482174d5e9

View File

@ -10,7 +10,7 @@ import useSWR from 'swr';
export default function Recording({ camera, date, hour = '00', minute = '00', second = '00' }) {
const { data: config } = useSWR('config');
const timezone = config?.ui?.timezone || Intl.DateTimeFormat().resolvedOptions().timeZone;
let timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
const currentDate = useMemo(
() => (date ? parseISO(`${date}T${hour || '00'}:${minute || '00'}:${second || '00'}`) : new Date()),
[date, hour, minute, second]
@ -114,10 +114,14 @@ export default function Recording({ camera, date, hour = '00', minute = '00', se
}
}, [seekSeconds, playlistIndex]);
if (!recordingsSummary || !recordings) {
if (!recordingsSummary || !recordings || !config) {
return <ActivityIndicator />;
}
if (config.ui.timezone) {
timezone = config.ui.timezone;
}
if (recordingsSummary.length === 0) {
return (
<div className="space-y-4">