2020
10-30
10-30
解决antd datepicker 获取时间默认少8个小时的问题
1、扩展日期格式化方法Date.prototype.format=function(fmt){leto={"M+":this.getMonth()+1,//月份"d+":this.getDate(),//日"h+":this.getHours(),//小时"m+":this.getMinutes(),//分"s+":this.getSeconds(),//秒"q+":Math.floor((this.getMonth()+3)/3),//季度"S":this.getMilliseconds()//毫秒};if(/(y+)/.test(fmt)){fmt=f...
继续阅读 >
1、某个时间段importReactfrom'react';importmomentfrom'moment';classDateDemoextendsReact.Component{disabledDate=(current)=>{returncurrent<moment().startOf('day')||current>moment().add(6,'day');};datePickerChange=(date)=>{console.log(date,'date即为DatePicker选中的时间');}render(){return(<div><DatePickerdisabledDate={this.disabledDate}onChange...