Skip to content

siddharth223437/nuxt-date-fns

Repository files navigation

date-fns for Nuxt

Version License Types

💡 About

date-fns auto-import module for Nuxt.

📦 Install

  1. 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
  1. Add it to the modules section of your nuxt.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

About

date-fns module for nuxt

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published