How to use the react-day-picker.DateUtils.addMonths function in react-day-picker

To help you get started, we’ve selected a few react-day-picker examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sentinel-hub / EOBrowser / src / components / search / SearchForm.js View on Github external
this.setState(oldState => {
      let oldTimeTo = oldState.queryParams.timeTo;
      if (DateUtils.isDayAfter(new Date(e), new Date(oldTimeTo))) {
        oldTimeTo = DateUtils.addMonths(new Date(e), 1);
      }
      return {
        queryParams: {
          ...oldState.queryParams,
          timeFrom: moment(e),
          timeTo: moment(oldTimeTo),
        },
      };
    });
  }
github sentinel-hub / EOBrowser / src / components / search / SearchForm.js View on Github external
this.setState(oldState => {
      let oldTimeFrom = oldState.queryParams.timeFrom;
      if (DateUtils.isDayBefore(new Date(e), new Date(oldTimeFrom))) {
        oldTimeFrom = DateUtils.addMonths(new Date(e), -1);
      }
      return {
        queryParams: {
          ...oldState.queryParams,
          timeTo: moment(e),
          timeFrom: moment(oldTimeFrom),
        },
      };
    });
  }