Security News
npm Updates Search Experience with New Objective Sorting Options
npm has a revamped search experience with new, more transparent sorting options—Relevance, Downloads, Dependents, and Publish Date.
2KB immutable date time library alternative to Moment.js with the same modern API
Fast 2kB alternative to Moment.js with the same modern API
(This is an extended fork of the original project.)
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');
dayjs
instance by the instanceof
operator.npm install dayjs-ext --save
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
Day.js has great support for internationalization.
But none of them will be included in your build unless you use it.
import 'dayjs-ext/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
A plugin is an independent module that can be added to Day.js to extend functionality or add new features.
import timeZone from 'dayjs-ext/plugin/timeZone' // load on demand
dayjs.extend(timeZone) // use plugin
dayjs().format('D.M.YYYY H:mm',
{ timeZone: 'Europe/Berlin' }) // convert to CET before formatting
See the sponsor list at the original project. Thank you for your support!
See the contributor list at the original project. Thank you for your help!
Day.js is Extended licensed under a MIT License.
FAQs
2KB immutable date time library alternative to Moment.js with the same modern API
The npm package dayjs-ext receives a total of 4,030 weekly downloads. As such, dayjs-ext popularity was classified as popular.
We found that dayjs-ext demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
npm has a revamped search experience with new, more transparent sorting options—Relevance, Downloads, Dependents, and Publish Date.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.