【问题标题】:How can I do to see only day of the current month using a datepicker?如何使用日期选择器仅查看当前月份的某一天?
【发布时间】:2020-10-31 20:46:09
【问题描述】:

我正在使用 React.js,这是我的日期选择器的代码:

<DatePicker dateFormat="dd/MM/yyyy" selected={startDate} minDate={new Date()} onChange={date => setStartDate(date)} />

问题如下图所示:

My datepicker

如果我去 2020 年 12 月,我会看到 11 月的最后一天和 1 月的第一天......

我该怎么做才能删除它?

非常感谢!

【问题讨论】:

    标签: javascript html reactjs datepicker


    【解决方案1】:

    你可以覆盖这个类的CSS:

    .react-datepicker__day--outside-month {
      color: transparent !important;
      pointer-events: none;
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-11-09
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多