Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moment.js から Day.js に移行する #656

Open
cookie-s opened this issue Apr 9, 2022 · 5 comments
Open

Moment.js から Day.js に移行する #656

cookie-s opened this issue Apr 9, 2022 · 5 comments

Comments

@cookie-s
Copy link
Member

cookie-s commented Apr 9, 2022

dayjs にしたいねという気持ちはある

Originally posted by @hideo54 in #654 (review)

@cookie-s
Copy link
Member Author

ところでなんでなんだっけ @hideo54

@hideo54
Copy link
Member

hideo54 commented Apr 10, 2022

Moment.js は素晴らしいライブラリでしたが、既に開発を停止しており、開発側は「違うライブラリを使うべき」としているからです。一言で言えば、次の記述の通りです。

Moment.js is a legacy project, now in maintenance mode. In most cases, you should choose a different library.
https://github.com/moment/moment/

より詳しくは、公式 docs の "Project Status" に書かれています。要約すると、

  • 2011年に登場したライブラリであり、現代から見ると、オブジェクトが immutable でない、Tree shaking に対応しておらずサイズがデカい、などの不満がある。しかしこれらを解決するためにはほとんど作り直す必要があり、それはもう他のライブラリがある。
  • critical security issues には対応するし、新しいタイムゾーンの追加などは行うが、基本的に新機能の開発はしないし、バグ修正や localized strings の修正なども受け付けないかもしれない。

といった内容です。では何に移行するか、というと複数の選択肢があり、これまた公式 docs に丁寧な説明がありますが、個人的には最もよく使われている印象があり、かつ Moment の APi に近い、dayjs が良いのではないかと考えています。

@hideo54 hideo54 changed the title moment -> dayjs Moment.js から Day.js に移行する Apr 10, 2022
@hideo54
Copy link
Member

hideo54 commented Apr 10, 2022

RTM などとは違って特に急ぐ必要のない issue であるとは思います。

@cookie-s
Copy link
Member Author

なるほどな

@cookie-s
Copy link
Member Author

https://note.com/dinii/n/n315f0670e0df
なんかみつけた

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants