javascript - Running into problems using React Datepicker with rails -
i using datepicker plugin react: https://github.com/hacker0x01/react-datepicker
i keep getting following error: uncaught typeerror: this.props.moment not function in react-datepicker.min.js.
i copied example code, , can see input field, whenever click on render calendar, keeps giving error above. know had issue in past?
just resolved it, matter of not requiring "moment" js file in application.js. if use bundler install plug in sure add following gemfile:
source "https://rails-assets.org" gem 'rails-assets-react-date-picker' gem "rails-assets-moment" end
and require both in application.js in order:
//= require "moment" //= require "react-date-picker"
Comments
Post a Comment