vue-cli-plugin-dayjs
Vue CLI 3 plugin to add dayjs to your vue project.
🔥Install
❗️Do not install this package as a dependency, it will install the plugin source code instead installing the plugin, use the following command if your project is based on vue-cli 3+, it will automatically install day.js as devDependency and expose the $day() method as a Vue prototype for you to use in SFCs. Learn more about vue-cli plugins here: https://cli.vuejs.org/guide/plugins-and-presets.html
vue add dayjs
👾Usage
You can use the this.$day() method anywhere in your SFCs, to use it outside of SFCs, for example in vuex store files or js files simply import dayjs. Learn more about day.js here: https://github.com/iamkun/dayjs
this
💻Examples
SFCs
<!-- inside template/html --> {{ $day().format('DD-MM-YY hh:mma') }} <!-- 11-05-2019 04:05pm -->
// insdie script<script> { const now = this console // 11-05-2019 04:05pm }</script>