Today, we will learn DayJS: A Minimal yet Powerful Date Handling Experience! DayJS aims to provide a solution for the need for extensive date-time management APIs and lean package sizes by offering an API structure and pattern similar to MomentJS
Let’s face it, almost all web applications have some requirement for date-time handling, and choosing a library that caters to all our requirements yet is very lightweight is always a chore.
MomentJS has always been the solid offering for extensive date-time management options but it is currently in maintenance mode & can become bulky (whopping 4.21Mb unpacked size!) at times, especially when you are concerned about that extra 5Kb affecting your website load times!
One of the popular lean options that come up is
date-fns (our review of it can be found here) but the APIs are quite different from ones offered by MomentJS and it might take some time to learn if you come from a MomentJS background.
DayJS aims to provide a solution for the need for extensive date-time management APIs and lean package sizes by offering an API structure and pattern similar to MomentJS yet being just 2Kb (587Kb unpacked) in size for the core package. It achieves this by having a need-based plugins approach, requiring loading individual packages for a specific feature set.