Skip to content

Day.js with all plugins and locales added out of the box, no need to use dayjs.extend!

License

Notifications You must be signed in to change notification settings

ladjs/dayjs-with-plugins

Repository files navigation

dayjs-with-plugins

build status code style styled with prettier made with lass license npm downloads

Day.js with all plugins and locales added out of the box, no need to use dayjs.extend nor dayjs.locale!

Table of Contents

Install

npm:

npm install dayjs dayjs-with-plugins

Usage

Node

const dayjs = require('dayjs-with-plugins');

console.log('M/D/YY', dayjs().format('M/D/YY'));

Browser

VanillaJS

This is the solution for you if you're just using <script> tags everywhere!

<script src="https://cdnjs.cloudflare.com/polyfill/v3/polyfill.min.js?features=Promise"></script>
<script src="https://unpkg.com/dayjs-with-plugins"></script>
<script type="text/javascript">
  (function() {
    console.log('M/D/YY', dayjs().format('M/D/YY'));
  })();
</script>
Required Browser Features

We recommend using https://cdnjs.cloudflare.com/polyfill (specifically with the bundle mentioned in VanillaJS above):

<script src="https://cdnjs.cloudflare.com/polyfill/v3/polyfill.min.js?features=Promise"></script>
  • Promise is not supported in op_mini all

Bundler

This assumes you are using browserify, webpack, rollup, or another bundler.

See Node usage above for how to use in a bundler environment.

Debugging

You can use NODE_DEBUG=dayjs-with-plugins node app.js to debug output from this package.

Contributors

Name Website
Nick Baugh http://niftylettuce.com/

License

MIT © Nick Baugh