首页 > 解决方案 > React Native 如何获取当前月份的第一个和最后一个日期到 DatePicker

问题描述

如何在 React Native 中获取当前月份的第一天和最后一天到我的 DatePicker

constructor(props){
super(props)
this.state={
    modalVisible: false,
    date:new Date(),
    minfecha: '',
    maxfecha: '',
    isLoading: false,
},
this.setState({
    minfecha: new Date(this.state.date.getFullYear(), this.state.date.getMonth(), 1),
    maxfecha: new Date(this.state.date.getFullYear(), this.state.date.getMonth() + 1, 0)
});
}

标签: react-native

解决方案


推荐阅读