king
2 天以前 769b6a40f108415293c9f1ffdf0cd77a4623c496
2025-06-17
1个文件已修改
20 ■■■■■ 已修改文件
src/tabviews/zshare/topSearch/mkDatePicker/index.jsx 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/zshare/topSearch/mkDatePicker/index.jsx
@@ -38,11 +38,21 @@
      value = moment(value, format)
    }
    let presets = null
    if (mode === 'daterange' && format === 'YYYY-MM-DD' && sessionStorage.getItem('lang') === 'zh-CN') {
      presets = {
        '今天': [moment(), moment()],
        '当月': [moment().startOf('month'), moment().endOf('month')],
        '上月': [moment().subtract(1, 'months').startOf('month'), moment().subtract(1, 'months').endOf('month')],
      }
    }
    this.state = {
      value,
      mode,
      precision: config.precision || 'day',
      format
      format,
      presets
    }
  }
@@ -98,7 +108,7 @@
  }
  render() {
    const { value, mode, format, precision } = this.state
    const { value, mode, format, precision, presets } = this.state
    if (mode === 'date') {
      return <DatePicker dropdownClassName={'mk-date-picker ' + precision} value={value} showTime={format !== 'YYYY-MM-DD'} format={format} onChange={this.onChange}/>
@@ -107,11 +117,7 @@
    } else if (mode === 'week') {
      return <WeekPicker value={value} onChange={this.onChange}/>
    } else if (mode === 'daterange') {
      return <RangePicker ranges={format === 'YYYY-MM-DD' ? {
        '今天': [moment(), moment()],
        '当月': [moment().startOf('month'), moment().endOf('month')],
        '上月': [moment().subtract(1, 'months').startOf('month'), moment().subtract(1, 'months').endOf('month')],
      } : null} dropdownClassName={'mk-date-picker ' + precision} placeholder={['开始日期', '结束日期']} showTime={format !== 'YYYY-MM-DD'} format={format} value={value} onChange={this.onChange}/>
      return <RangePicker ranges={presets} dropdownClassName={'mk-date-picker ' + precision} showTime={format !== 'YYYY-MM-DD'} format={format} value={value} onChange={this.onChange}/>
    }
  }
}