nuxt3-date-fns
v0.2.0
Published
date-fns for Nuxt
Downloads
79
Maintainers
Readme
💡 About
date-fns auto-import module for Nuxt.
📦 Install
- Install
nuxt-date-fns
as development dependency:
npm i nuxt3-date-fns -D
yarn add nuxt3-date-fns -D
pnpm i nuxt3-date-fns -D
- Add it to the
modules
section of yournuxt.config
:
export default defineNuxtConfig({
modules: ["nuxt3-date-fns"],
});
🚀 Example
Use any Date-Fns methods in your Nuxt application, they will be auto-imported!
<script setup>
const date = useFormat(new Date(2024, 1, 11), "MM/dd/yyyy");
</script>
<template>
<div>{{ date }}</div>
</template>
🔨 Config
| Name | Default | Description |
| ------------------ | ------- |---------------------------------------------------------------------------------------|
| prefix
| 'use'
| String to prepend before each date-fns function (false to disable) |
💻 Example - Config
export default defineNuxtConfig({
modules: ["nuxt3-date-fns"],
"date-fns": {
prefix: "_",
},
});
📄 License
MIT License © 2024 - Siddharth Sarathe