JSPM

  • Created
  • Published
  • Downloads 21590721
  • Score
    100M100P100Q215242F
  • License MIT

2KB immutable date time library alternative to Moment.js with the same modern API

Package Exports

  • dayjs
  • dayjs/locale/af
  • dayjs/locale/am
  • dayjs/locale/ar
  • dayjs/locale/ar-dz
  • dayjs/locale/ar-iq
  • dayjs/locale/ar-kw
  • dayjs/locale/ar-ly
  • dayjs/locale/ar-ma
  • dayjs/locale/ar-sa
  • dayjs/locale/ar-tn
  • dayjs/locale/az
  • dayjs/locale/be
  • dayjs/locale/bg
  • dayjs/locale/bi
  • dayjs/locale/bm
  • dayjs/locale/bn
  • dayjs/locale/bn-bd
  • dayjs/locale/bo
  • dayjs/locale/br
  • dayjs/locale/bs
  • dayjs/locale/ca
  • dayjs/locale/cs
  • dayjs/locale/cv
  • dayjs/locale/cy
  • dayjs/locale/da
  • dayjs/locale/de
  • dayjs/locale/de-at
  • dayjs/locale/de-ch
  • dayjs/locale/dv
  • dayjs/locale/el
  • dayjs/locale/en
  • dayjs/locale/en-au
  • dayjs/locale/en-ca
  • dayjs/locale/en-gb
  • dayjs/locale/en-ie
  • dayjs/locale/en-il
  • dayjs/locale/en-in
  • dayjs/locale/en-nz
  • dayjs/locale/en-sg
  • dayjs/locale/en-tt
  • dayjs/locale/eo
  • dayjs/locale/es
  • dayjs/locale/es-do
  • dayjs/locale/es-mx
  • dayjs/locale/es-pr
  • dayjs/locale/es-us
  • dayjs/locale/et
  • dayjs/locale/eu
  • dayjs/locale/fa
  • dayjs/locale/fi
  • dayjs/locale/fo
  • dayjs/locale/fr
  • dayjs/locale/fr-ca
  • dayjs/locale/fr-ch
  • dayjs/locale/fy
  • dayjs/locale/ga
  • dayjs/locale/gd
  • dayjs/locale/gl
  • dayjs/locale/gom-latn
  • dayjs/locale/gu
  • dayjs/locale/he
  • dayjs/locale/hi
  • dayjs/locale/hr
  • dayjs/locale/ht
  • dayjs/locale/hu
  • dayjs/locale/hy-am
  • dayjs/locale/id
  • dayjs/locale/index
  • dayjs/locale/is
  • dayjs/locale/it
  • dayjs/locale/it-ch
  • dayjs/locale/ja
  • dayjs/locale/jv
  • dayjs/locale/ka
  • dayjs/locale/kk
  • dayjs/locale/km
  • dayjs/locale/kn
  • dayjs/locale/ko
  • dayjs/locale/ku
  • dayjs/locale/ky
  • dayjs/locale/lb
  • dayjs/locale/lo
  • dayjs/locale/lt
  • dayjs/locale/lv
  • dayjs/locale/me
  • dayjs/locale/mi
  • dayjs/locale/mk
  • dayjs/locale/ml
  • dayjs/locale/mn
  • dayjs/locale/mr
  • dayjs/locale/ms
  • dayjs/locale/ms-my
  • dayjs/locale/mt
  • dayjs/locale/my
  • dayjs/locale/nb
  • dayjs/locale/ne
  • dayjs/locale/nl
  • dayjs/locale/nl-be
  • dayjs/locale/nn
  • dayjs/locale/oc-lnc
  • dayjs/locale/pa-in
  • dayjs/locale/pl
  • dayjs/locale/pt
  • dayjs/locale/pt-br
  • dayjs/locale/rn
  • dayjs/locale/ro
  • dayjs/locale/ru
  • dayjs/locale/rw
  • dayjs/locale/sd
  • dayjs/locale/se
  • dayjs/locale/si
  • dayjs/locale/sk
  • dayjs/locale/sl
  • dayjs/locale/sq
  • dayjs/locale/sr
  • dayjs/locale/sr-cyrl
  • dayjs/locale/ss
  • dayjs/locale/sv
  • dayjs/locale/sv-fi
  • dayjs/locale/sw
  • dayjs/locale/ta
  • dayjs/locale/te
  • dayjs/locale/tet
  • dayjs/locale/tg
  • dayjs/locale/th
  • dayjs/locale/tk
  • dayjs/locale/tl-ph
  • dayjs/locale/tlh
  • dayjs/locale/tr
  • dayjs/locale/types
  • dayjs/locale/tzl
  • dayjs/locale/tzm
  • dayjs/locale/tzm-latn
  • dayjs/locale/ug-cn
  • dayjs/locale/uk
  • dayjs/locale/ur
  • dayjs/locale/uz
  • dayjs/locale/uz-latn
  • dayjs/locale/vi
  • dayjs/locale/x-pseudo
  • dayjs/locale/yo
  • dayjs/locale/zh
  • dayjs/locale/zh-cn
  • dayjs/locale/zh-hk
  • dayjs/locale/zh-tw
  • dayjs/plugin/advancedFormat
  • dayjs/plugin/arraySupport
  • dayjs/plugin/badMutable
  • dayjs/plugin/buddhistEra
  • dayjs/plugin/calendar
  • dayjs/plugin/customParseFormat
  • dayjs/plugin/dayOfYear
  • dayjs/plugin/devHelper
  • dayjs/plugin/duration
  • dayjs/plugin/isBetween
  • dayjs/plugin/isLeapYear
  • dayjs/plugin/isMoment
  • dayjs/plugin/isSameOrAfter
  • dayjs/plugin/isSameOrBefore
  • dayjs/plugin/isToday
  • dayjs/plugin/isTomorrow
  • dayjs/plugin/isYesterday
  • dayjs/plugin/isoWeek
  • dayjs/plugin/isoWeeksInYear
  • dayjs/plugin/localeData
  • dayjs/plugin/localizedFormat
  • dayjs/plugin/minMax
  • dayjs/plugin/objectSupport
  • dayjs/plugin/pluralGetSet
  • dayjs/plugin/preParsePostFormat
  • dayjs/plugin/quarterOfYear
  • dayjs/plugin/relativeTime
  • dayjs/plugin/timezone
  • dayjs/plugin/toArray
  • dayjs/plugin/toObject
  • dayjs/plugin/updateLocale
  • dayjs/plugin/utc
  • dayjs/plugin/weekOfYear
  • dayjs/plugin/weekYear
  • dayjs/plugin/weekday

Readme

English | 简体中文 | 日本語 | Português Brasileiro | 한국어 | Español (España) | Русский | Türkçe | සිංහල

Day.js

Fast 2kB alternative to Moment.js with the same modern API

Gzip Size NPM Version Build Status Codecov License
Sauce Test Status

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.

dayjs().startOf('month').add(1, 'day').set('year', 2018).format('YYYY-MM-DD HH:mm:ss');
  • 🕒 Familiar Moment.js API & patterns
  • 💪 Immutable
  • 🔥 Chainable
  • 🌐 I18n support
  • 📦 2kb mini library
  • 👫 All browsers supported

Getting Started

Documentation

You can find for more details, API, and other docs on day.js.org website.

Installation

npm install dayjs --save

📚Installation Guide

API

It's easy to use Day.js APIs to parse, validate, manipulate, and display dates and times.

dayjs('2018-08-08') // parse

dayjs().format('{YYYY} MM-DDTHH:mm:ss SSS [Z] A') // display

dayjs().set('month', 3).month() // get & set

dayjs().add(1, 'year') // manipulate

dayjs().isBefore(dayjs()) // query

📚API Reference

I18n

Day.js has great support for internationalization.

But none of them will be included in your build unless you use it.

import 'dayjs/locale/es' // load on demand

dayjs.locale('es') // use Spanish locale globally

dayjs('2018-05-05').locale('zh-cn').format() // use Chinese Simplified locale in a specific instance

📚Internationalization

Plugin

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 demand

dayjs.extend(advancedFormat) // use plugin

dayjs().format('Q Do k kk X x') // more available formats

📚Plugin List

Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website.

[Become a sponsor via Github] [Become a sponsor via OpenCollective]

                                                     

Contributors

This project exists thanks to all the people who contribute.

Please give us a 💖 star 💖 to support us. Thank you.

And thank you to all our backers! 🙏

License

Day.js is licensed under a MIT License.