Day.js with all plugins and locales added out of the box, no need to use
dayjs.extend
nordayjs.locale
!
npm:
npm install dayjs dayjs-with-plugins
const dayjs = require('dayjs-with-plugins');
console.log('M/D/YY', dayjs().format('M/D/YY'));
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>
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
This assumes you are using browserify, webpack, rollup, or another bundler.
See Node usage above for how to use in a bundler environment.
You can use NODE_DEBUG=dayjs-with-plugins node app.js
to debug output from this package.
Name | Website |
---|---|
Nick Baugh | http://niftylettuce.com/ |