Ios React本机函数在调试模式下工作,但不在发布模式下工作

Ios React本机函数在调试模式下工作,但不在发布模式下工作,ios,reactjs,react-native,momentjs,Ios,Reactjs,React Native,Momentjs,我花了一整天的时间来解决这个问题,下面的函数不是在发布模式下工作,而是在调试模式下工作。它应该返回日期范围 import moment from 'moment'; this.state = { startDate: '01-01-2019', endDate: '02-02-2019' }; getArr(checkedWeekDay) { const { endDate, startDate } = this.state; const dateRange = [];

我花了一整天的时间来解决这个问题,下面的函数不是在发布模式下工作,而是在调试模式下工作。它应该返回日期范围

import moment from 'moment';

this.state = {
startDate: '01-01-2019',
endDate: '02-02-2019'
};
getArr(checkedWeekDay) {
    const { endDate, startDate } = this.state;

    const dateRange = [];
    const endOfRange = moment(endDate).endOf('month');
    const startOfRange = moment(startDate).startOf('month').day(checkedWeekDay);
    const S = 7;
    const O = 1;

    if (startOfRange.date() > S) startOfRange.add(S, 'days');

    for (let $index = startOfRange; $index < endOfRange; $index.add(O, 'M')) {
      const startOfIndex = moment($index).startOf('month').day(checkedWeekDay);

      if (startOfIndex.date() > S) startOfIndex.add(S, 'days');
      const startIndex = startOfIndex.clone();

      while (startOfIndex.month() === startIndex.month()) {
        if (startIndex >= moment(startDate) && startIndex <= moment(endDate)) {
          dateRange.push(startIndex.format('YYYY-MM-DD'));
        }
        startIndex.add(S, 'days');
      }
    }
    return dateRange;
  }

this.getArr(5);

从“时刻”导入时刻;
此.state={
起始日期:“2019年1月1日”,
截止日期:2019年2月2日
};
getArr(已检查的工作日){
const{endDate,startDate}=this.state;
常量日期范围=[];
const endOfRange=时刻(endDate).endOf('month');
常量开始时间范围=时刻(开始日期)。开始时间(“月份”)。日期(检查工作日);
常数S=7;
常数O=1;
如果(startOfRange.date()>S)startOfRange.add(S,'days');
for(让$index=startOfRange;$indexS)startOfIndex.add(S,'days');
const startIndex=startofinex.clone();
而(startOfIndex.month()==startIndex.month()){
如果(起始指数>=力矩(起始日期)&&startIndex