Skip to content

Commit

Permalink
fixed bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Mond1c committed Dec 23, 2023
1 parent 6630f77 commit 45c2a6c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
6 changes: 5 additions & 1 deletion src/frontend/admin/src/components/TickerTableRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ export function TickerTableRow({ data, onShow, onEdit, onDelete }) {
<Box onSubmit={onSubmitEdit} component="form" type="submit">
<TextField autoFocus hiddenLabel fullWidth defaultValue={data.settings.timeZone}
id="filled-hidden-label-small" type="text" size="small" sx={{ width: 1 }}
onChange={onChangeFieldEventHandler(setEditData, "timeZone")}/>
onChange={(event) => {
if (event.target.value.match(/^utc((\\+|-)\\d\\d?)?$/g) || event.target.value === "") {
onChangeFieldEventHandler(setEditData, "timeZone")(event);
}
}}/>
</Box>)
)}
{data.settings.type === "text" &&
Expand Down
9 changes: 4 additions & 5 deletions src/frontend/overlay/src/components/molecules/Clock.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const ContestClock = ({
globalTimeMode = false,
contestCountdownMode = false,
quietMode = false,
timeZone = ""
timeZone = null
}) => {
const formatTime = (time, fullFormat = false) => {
if (!fullFormat && quietMode && time > 5 * 60 * 1000) {
Expand All @@ -34,13 +34,12 @@ export const ContestClock = ({

const getDateTimeNowWithCustomTimeZone = (zone) =>
DateTime.now().setZone(zone).toFormat(quietMode ? "HH:mm" : "HH:mm:ss");

const getStatus = useCallback(() => {
if (globalTimeMode === true ) {
return getDateTimeNowWithCustomTimeZone(new SystemZone());
if (globalTimeMode === true) {
return getDateTimeNowWithCustomTimeZone(timeZone ?? new SystemZone());
}

if (timeZone !== "") {
if (timeZone !== null) {
return getDateTimeNowWithCustomTimeZone(timeZone);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import ContestClock from "../../molecules/Clock";
export const Clock = ({tickerSettings, part}) => {
return <TextWrap>
<ContestClock
timeZone={tickerSettings.timeZone}
timeZone={tickerSettings.timeZone.length === 0 ? null : tickerSettings.timeZone}
/>
</TextWrap>;
};
Expand Down

0 comments on commit 45c2a6c

Please sign in to comment.