Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const previousStateValue = stateValue;
if (event.keyCode === KeyCode.KEY_UP) {
stateValue = TimeUtil.incrementMinute(stateValue);
}
if (event.keyCode === KeyCode.KEY_DOWN) {
stateValue = TimeUtil.decrementMinute(stateValue);
}
if (previousStateValue !== stateValue) {
this.handleValueChange(event, TimeUtil.inputType.MINUTE, stateValue, this.state.meridiem);
}
if (event.keyCode === KeyCode.KEY_LEFT
|| event.keyCode === KeyCode.KEY_DELETE
|| event.keyCode === KeyCode.KEY_BACK_SPACE) {
this.focusHour(event);
}
if (event.keyCode === KeyCode.KEY_RIGHT && this.props.showSeconds) {
this.focusSecondFromMinute(event);
}
}
if (event.keyCode === KeyCode.KEY_UP) {
event.preventDefault();
stateValue = DateInputUtil.incrementYear(stateValue);
}
if (event.keyCode === KeyCode.KEY_DOWN) {
event.preventDefault();
stateValue = DateInputUtil.decrementYear(stateValue);
}
if (previousStateValue !== stateValue) {
this.handleValueChange(event, DateInputUtil.inputType.YEAR, stateValue);
}
if (event.keyCode === KeyCode.KEY_BACK_SPACE || event.keyCode === KeyCode.KEY_DELETE) {
if (displayFormat === 'month-day-year' && event.target.value === '') {
this.focusDay(event);
}
if (displayFormat === 'day-month-year' && event.target.value === '') {
this.focusMonth(event);
}
}
}