reactjs - 获取反应日历的开始和结束日期
问题描述
我在用"react-big-calendar": "^0.20.3",
目前我正在使用getDrilldownView={(targetDate, currentViewName, configuredViewNames) => this.updateDate(targetDate, currentViewName, configuredViewNames)}
组件上的道具来获取大日历反应 js 中的开始和结束时间。我觉得这不是获取开始和结束日期的好方法,我也无法在文档中找到它。
https://codesandbox.io/s/vw3wlm63y
我想要的是 2019/1/27 作为开始日期和 2019/3/2 作为结束日期
并onRangeChange
在视图或日期更改时给出开始和结束日期,但我想要在页面加载时
解决方案
我在用
this.startDate = moment().subtract(1, 'months').endOf('month').startOf('week').format('YYYY/MM/DD');
this.endDate = moment().add(1, 'months').startOf('month').endOf('week').format('YYYY/MM/DD');
它可以获取第一次加载当前日历视图的开始和结束日期。我认为没有内置的方法来获取详细信息。
推荐阅读
- sql - 用于检查一列中是否出现多个条件的 SQL 查询
- reactjs - 尝试使用 Formik 重构 onSubmit 属性
- excel - 将文本发送到另一个应用程序
- javascript - 在 useEffect 挂钩内或返回渲染之前“执行任务”之间的区别
- java - 让 Eclipse Java 组织导入以使用 Google checkstyle
- wordpress - 带有路径映射的 Wordpress 应用程序服务非常慢
- java - Flux:当某些元素具有具体价值时,如何防止元素处理?
- java - 在 JavaCC 中扩展 Token 类
- javascript - 如何在 JavaScript 中提取 BigInt 的第 n 个根?
- java - Java中的乘法表使用方法