Skip to content

Commit 752242e

Browse files
committed
fix TimeLine
1 parent 3c19f7c commit 752242e

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

Signum/React/Lines/DateTimeSplittedLine.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import TextArea from '../Components/TextArea';
1212
import { KeyCodes } from '../Components/Basic';
1313
import { ValueBaseController, ValueBaseProps } from './ValueBase'
1414
import { defaultRenderDay, trimDateToFormat } from './DateTimeLine'
15-
import { TimeTextBox, isDuration } from './TimeLine'
15+
import { TimeTextBox, isDurationKey } from './TimeLine'
1616
import { TypeContext } from '../TypeContext'
1717

1818
export interface DateTimeSplittedLineProps extends ValueBaseProps<DateTimeSplittedLineController> {
@@ -200,7 +200,7 @@ function DateTimePickerSplitted(p: {
200200
(p.value ? getTimeOfDay(DateTime.fromJSDate(p.value))?.toISOTime() : null) :
201201
(temp.type == "Time" ? temp.time : null)}
202202
onChange={handleTimeChange}
203-
validateKey={isDuration}
203+
validateKey={isDurationKey}
204204
htmlAttributes={{
205205
...p.htmlAttributes,
206206
placeholder: timePlaceholder(timeFormat),

Signum/React/Lines/TimeLine.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import * as React from 'react';
2-
import { addClass, classes, isNumber } from '../Globals';
2+
import { addClass, classes } from '../Globals';
33
import { timeToString, timePlaceholder, toLuxonDurationFormat } from '../Reflection';
44
import { LineBaseController, useController } from '../Lines/LineBase';
55
import { FormGroup } from '../Lines/FormGroup';
66
import { FormControlReadonly } from '../Lines/FormControlReadonly';
77
import { ValueBaseController, ValueBaseProps } from './ValueBase';
88
import { Duration } from 'luxon';
9+
import { isNumberKey } from './NumberLine';
910

1011
export interface TimeLineProps extends ValueBaseProps<TimeLineController> {
1112

@@ -59,7 +60,7 @@ export const TimeLine = React.memo(React.forwardRef(function TimeLine(props: Tim
5960
id={inputId}
6061
value={s.ctx.value}
6162
onChange={handleOnChange}
62-
validateKey={isDuration}
63+
validateKey={isDurationKey}
6364
formControlClass={classes(s.ctx.formControlClass, c.mandatoryClass)}
6465
durationFormat={durationFormat}
6566
innerRef={c.setRefs} />
@@ -165,7 +166,7 @@ TimeTextBox.defaultProps = {
165166
durationFormat: "hh:mm:ss"
166167
};
167168

168-
export function isDuration(e: React.KeyboardEvent<any>): boolean {
169+
export function isDurationKey(e: React.KeyboardEvent<any>): boolean {
169170
const c = e.keyCode;
170-
return isNumber(e) || e.key == ":";
171+
return isNumberKey(e) || e.key == ":";
171172
}

0 commit comments

Comments
 (0)