fix: simplify time input

This commit is contained in:
cv
2021-05-25 10:19:54 +02:00
parent fa98e2ad92
commit b252aa19b9
+2 -8
View File
@@ -34,12 +34,12 @@ export default function EditableTimer(props) {
if (value === '') return false;
// Time now and time submitedVal
const original = stringFromMillis(time, false);
const original = stringFromMillis(time + delay, false);
// check if time is different from before
if (value === original) return false;
// conver to millis object
// convert to millis object
const millis = timeStringToMillis(value, timeFormat);
// validate with parent
@@ -51,14 +51,8 @@ export default function EditableTimer(props) {
return true;
};
const showOriginal = () => {
setValue(stringFromMillis(time, false));
};
return (
<Editable
onFocus={() => showOriginal}
onEdit={() => showOriginal}
onChange={(v) => setValue(v)}
onSubmit={(v) => validateValue(v)}
value={value}