Day.js - Free open source, minimalist javascript time and date library, excellent alternative to Moment.js

Day.js - Free open source, minimalist javascript time and date library, excellent alternative to Moment.js

A 2kB lightweight alternative to Moment.js with the same powerful API.

About Day.js

Day.js is a minimalist JavaScript library, mainly for modern browsers to parse, validate, manipulate and display date and time. Through a simple and general API, it solves the need for time and date processing in development.

dayjs official website

Technical Features of Day.js

  • Only takes up about 2kb space, whether it is loaded or executed, it is very simple
  • Has the same API and mode as Moment.js, no cost to get started
  • All API operations that change Day.js objects return new instances, preventing errors and avoiding long debugging sessions
  • Provide international support
  • TypeScript support

Develop hands-on experience

There are many APIs for javascript's native operation time, and it is very cumbersome. It is not easy to remember these APIs, and the output time is often not the localized time we ultimately want. So Moment.js, a powerful time processing library, was born, solving the nightmare of many developers dealing with time. But the functions provided by Moment.js are too powerful and comprehensive, resulting in a footprint of more than 200k.

Many time processing requirements are actually very simple. I believe that many developers, like me, are reluctant to introduce a Moment.js that exceeds the space occupied by vue.js several times for the processing time. The 2k-sized Day.js introduced today is a good alternative. The point is, the API design of Day.js is exactly the same as Moment.js.

Day.js can be introduced by cdn, or installed through npm, and can also be used in node.js environment. Such as time calculation, comparison, addition and subtraction processing is not a problem, and this library itself is a library developed by the Chinese, the official website documents are naturally written in Chinese, and reading is extremely smooth.

dayjs documentation

Free Open Source Instructions

Day.js is developed by iamkun, a developer from Shanghai. It is hosted on Github based on the MIT open source license , and can be used by any individual and company for free.

Original link: https://www.thosefree.com/dayjs

Guess you like

Origin blog.csdn.net/weixin_45583710/article/details/122298354