vue-cli-plugin-dayjs
v0.1.2
Published
Vue CLI 3 plugin to add dayjs to your vue project
Downloads
218
Maintainers
Readme
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.$day()
💻Examples
SFCs
<!-- inside template/html -->
<template>
<p>{{ $day().format('DD-MM-YY hh:mma') }}</p> <!-- 11-05-2019 04:05pm -->
</template>
// insdie script
<script>
export default {
created() {
const now = this.$day().format('DD-MM-YY hh:mma')
console.log(now) // 11-05-2019 04:05pm
}
}
</script>