diff --git a/src/components/Reminder/IntervalSelector.tsx b/src/components/Reminder/IntervalSelector.tsx
index 1eaddb2..efa7ae7 100644
--- a/src/components/Reminder/IntervalSelector.tsx
+++ b/src/components/Reminder/IntervalSelector.tsx
@@ -65,7 +65,10 @@ export const IntervalSelector = ({
placeholder=""
value={months || placeholder()}
onInput={(ev) => {
- setMonths(parseInt(ev.currentTarget.value));
+ const value = ev.currentTarget.value;
+ if (value && !isNaN(parseInt(value))) {
+ setMonths(parseInt(ev.currentTarget.value));
+ }
}}
>{" "}
months,
@@ -81,7 +84,10 @@ export const IntervalSelector = ({
placeholder=""
value={days || placeholder()}
onInput={(ev) => {
- setDays(parseInt(ev.currentTarget.value));
+ const value = ev.currentTarget.value;
+ if (value && !isNaN(parseInt(value))) {
+ setDays(parseInt(ev.currentTarget.value));
+ }
}}
>{" "}
days,
@@ -99,7 +105,10 @@ export const IntervalSelector = ({
placeholder="HH"
value={hours || placeholder()}
onInput={(ev) => {
- setHours(parseInt(ev.currentTarget.value));
+ const value = ev.currentTarget.value;
+ if (value && !isNaN(parseInt(value))) {
+ setHours(parseInt(ev.currentTarget.value));
+ }
}}
>
:
@@ -115,7 +124,10 @@ export const IntervalSelector = ({
placeholder="MM"
value={minutes || placeholder()}
onInput={(ev) => {
- setMinutes(parseInt(ev.currentTarget.value));
+ const value = ev.currentTarget.value;
+ if (value && !isNaN(parseInt(value))) {
+ setMinutes(parseInt(ev.currentTarget.value));
+ }
}}
>
:
@@ -131,7 +143,10 @@ export const IntervalSelector = ({
placeholder="SS"
value={seconds || placeholder()}
onInput={(ev) => {
- setSeconds(parseInt(ev.currentTarget.value));
+ const value = ev.currentTarget.value;
+ if (value && !isNaN(parseInt(value))) {
+ setSeconds(parseInt(ev.currentTarget.value));
+ }
}}
>
diff --git a/src/components/Reminder/TimeInput.tsx b/src/components/Reminder/TimeInput.tsx
index fd90529..df16a7d 100644
--- a/src/components/Reminder/TimeInput.tsx
+++ b/src/components/Reminder/TimeInput.tsx
@@ -1,12 +1,10 @@
import { useEffect, useRef, useState } from "preact/hooks";
import { DateTime } from "luxon";
-import { useTimezone } from "../App/TimezoneProvider";
export const TimeInput = ({ defaultValue, onInput }) => {
const format = "yyyy-LL-dd, HH:mm:ss";
const ref = useRef(null);
- const [zone] = useTimezone();
const [time, setTime] = useState(defaultValue);
useEffect(() => {
@@ -23,7 +21,7 @@ export const TimeInput = ({ defaultValue, onInput }) => {
fontSize: "16px",
}}
value={time && time.toFormat(format)}
- onInput={(ev) => {
+ onBlur={(ev) => {
const dt = DateTime.fromFormat(ev.currentTarget.value, format);
if (dt.isValid) {
setTime(dt);
@@ -49,8 +47,11 @@ export const TimeInput = ({ defaultValue, onInput }) => {