【发布时间】:2023-03-11 17:19:01
【问题描述】:
我在 moment.js 中设置小时有问题,状态似乎需要一点延迟来解决时间才能改变状态。
我的事件处理程序如下所示
handleKeyDownPickerInput(e, type) {
let input = e.target.value;
if (!input || isNaN(input)) return;
if (type === "hour") {
this.setState({
currentTime: moment(this.state.currentTime).set({ h: input })
});
}
}
【问题讨论】:
标签: javascript reactjs ecmascript-6 momentjs