Adw*_*hna 2 javascript node.js momentjs reactjs
我想将日期设置为另一天,然后在日期上加 1。
onModalPrevDate=()=>{
this.closeModal();
let d=this.state.selectedDay;
let dateContext = Object.assign({}, this.props.dateContext);
let c=moment(dateContext).set("days",d); //not working as intended
let f=moment(c).add(1,"day");
let a=f.format("D");
this.onDayClick(a);
}
Run Code Online (Sandbox Code Playgroud)
时刻(dateContext).set("days",d); 没有按预期工作。尝试过“day”而不是“days”仍然无效。
Adw*_*hna 14
使用“日期”而不是“天”
let c=moment(dateContext).set("date",d);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
13091 次 |
| 最近记录: |