This is Qiita's first post. If you find something wrong, I would appreciate it if you could point it out.
ruby 2.6.5 Rails 220.127.116.11
Install moment.js in the directory you are working on
npm install moment
Load moment with the js file you want to use
var moment = require(“moment”);
↓ You can generate it in this way
const dt = new moment();
However, this alone will get stuck in rails s. ↓ You will probably need to reinstall yarn.
error Lockfile does not contain pattern: "moment@^2.29.1" error Found 1 errors. ======================================== Your Yarn packages are out of date! Please run `yarn install --check-files` to update. ======================================== To disable this check, please change `check_yarn_integrity` to `false` in your webpacker config file (config/webpacker.yml).
check_yarn_integrity is False by default I'll just run yarn install --check-files
yarn install --check-files
I was able to use it without problems
moment.js is a legacy technology and may not be used much in the future. It is said that day.js is lighter and is upward compatible in terms of management, Since I may be active in active duty, I tried using it on a trial basis.
This person's article will be helpful when migrating. (I'm sorry to post it without permission) https://qiita.com/oika/items/2d15aea7809ab358ba25