Fast 2kB alternative to Moment.js with the same modern API
Day.js is a minimalist JavaScript library that parses, validates, manipulates, and displays dates and times for modern browsers with a largely Moment.js-compatible API. If you use Moment.js, you already know how to use Day.js.
Day.js has great support for internationalization.
But none of them will be included in your build unless you use them.
import 'dayjs/locale/es' // load on demanddayjs.locale('es') // use Spanish locale globallydayjs('2018-05-05').locale('zh-cn').format() // use Chinese Simplified locale in a specific instance
A plugin is an independent module that can be added to Day.js to extend functionality or add new features.
import advancedFormat from 'dayjs/plugin/advancedFormat' // load on demanddayjs.extend(advancedFormat) // use plugindayjs().format('Q Do k kk X x') // more available formats