mirror of
https://github.com/cpvalente/ontime.git
synced 2026-09-04 13:59:09 +00:00
fix: simplify time input
This commit is contained in:
@@ -34,12 +34,12 @@ export default function EditableTimer(props) {
|
|||||||
if (value === '') return false;
|
if (value === '') return false;
|
||||||
|
|
||||||
// Time now and time submitedVal
|
// Time now and time submitedVal
|
||||||
const original = stringFromMillis(time, false);
|
const original = stringFromMillis(time + delay, false);
|
||||||
|
|
||||||
// check if time is different from before
|
// check if time is different from before
|
||||||
if (value === original) return false;
|
if (value === original) return false;
|
||||||
|
|
||||||
// conver to millis object
|
// convert to millis object
|
||||||
const millis = timeStringToMillis(value, timeFormat);
|
const millis = timeStringToMillis(value, timeFormat);
|
||||||
|
|
||||||
// validate with parent
|
// validate with parent
|
||||||
@@ -51,14 +51,8 @@ export default function EditableTimer(props) {
|
|||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
const showOriginal = () => {
|
|
||||||
setValue(stringFromMillis(time, false));
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Editable
|
<Editable
|
||||||
onFocus={() => showOriginal}
|
|
||||||
onEdit={() => showOriginal}
|
|
||||||
onChange={(v) => setValue(v)}
|
onChange={(v) => setValue(v)}
|
||||||
onSubmit={(v) => validateValue(v)}
|
onSubmit={(v) => validateValue(v)}
|
||||||
value={value}
|
value={value}
|
||||||
|
|||||||
Reference in New Issue
Block a user