npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

nuxt-luxon

v1.2.0

Published

Easy DateTime formatting & parsing in Vue using Luxon

Readme

Nuxt Luxon

npm version npm downloads License Nuxt

Integrates the Luxon library with Nuxt 3, providing a simple and powerful way to work with dates and times in your Nuxt application.

Features

  • 🕰️ Easy DateTime formatting & parsing with Luxon
  • 🧩 Predefined templates for common date formats
  • 🌐 Global date/time utilities via composables
  • 🎛️ Fully customizable via module options
  • 📝 Fully typed with TypeScript support
  • ✅ Fully tested for reliability

Installation

# Using npm
npm install nuxt-luxon

# Using yarn
yarn add nuxt-luxon

# Using pnpm
pnpm add nuxt-luxon

Setup

Add nuxt-luxon to the modules section of your nuxt.config.ts:

export default defineNuxtConfig({
  modules: [
    'nuxt-luxon', // Add the module here
  ],
  // Default options
  luxon: {
    input: {
      zone: 'utc',
      format: 'iso',
    },
    output: {
      format: 'short',
      zone: 'local',
      locale: 'client',
    },
    templates: {
      // Custom templates
    },
  },
})

Basic Usage

<template>
  <div>
    <!-- Format dates with predefined templates -->
    <p>{{ $luxon(new Date()) }}</p>
    <p>{{ $luxon(new Date(), 'full') }}</p>
    
    <!-- Custom format strings -->
    <p>{{ $luxon(new Date(), 'yyyy-MM-dd') }}</p>
  </div>
</template>

<script setup>
// Access utilities via the composable
const { $luxon, $lp } = useLuxon()

// Parse dates
const parsedDate = $lp('2025-05-10')

// Format dates
const formattedDate = $luxon(parsedDate, 'full')
</script>

Custom Templates

Templates can be used for both parsing and formatting dates. This is especially useful when you need consistent date formats across your application or when working with specific regional formats.

export default defineNuxtConfig({
  modules: ['nuxt-luxon'],
  luxon: {
    templates: {
      userDate: {
        zone: 'local',
        format: 'dd MM yyyy',
      },
      serverAMS: {
        zone: 'Europe/Amsterdam',
        format: 'dd-MM-yyyy HH:mm:ss',
      },
      client: {
        zone: 'local',
        format: 'short',
      },
    }
  }
})

Then you can use these templates for both parsing and formatting:

<script setup>
const { $luxon, $lp } = useLuxon()

// Parse a date using a template
const parsedDate = $lp('15 05 2025', 'userDate')

// Format a date using a template
const amsterdamTime = $luxon(new Date(), 'serverAMS')
</script>

API

Composable: useLuxon()

The main composable that provides formatting and parsing utilities:

const { $luxon, $lf, $lp } = useLuxon()
  • $luxon / $lf - Format dates and times
  • $lp - Parse dates and times

Formatting: $luxon(value, format?, inputFormat?)

Format a date value using the specified format:

// Basic usage with predefined formats
$luxon(new Date(), 'short')       // '5/10/25, 12:00 PM'
$luxon('2025-05-10', 'full')      // 'May 10, 2025 at 12:00 PM UTC'
$luxon(1715270400000, 'date')     // '5/10/2025'

// Custom format
$luxon(new Date(), 'yyyy-MM-dd')  // '2025-05-10'

// With input format
$luxon('05/10/2025', 'full', 'MM/dd/yyyy')

Parsing: $lp(value, format?)

Parse a value into a Luxon DateTime object:

// Parse from various formats
const date = $lp('2025-05-10')            // Parse ISO format
const fromUnix = $lp(1715270400, 'unix')  // Parse Unix timestamp (seconds)
const fromJs = $lp(new Date())            // Parse JS Date object

// Custom parsing
const custom = $lp('05/10/2025', 'MM/dd/yyyy')

Built-in Templates

The module includes several predefined format templates:

| Name | Description | Example | |------|-------------|---------| | full | Full date/time | May 10, 2025, 12:00 PM UTC | | fulls | Full with seconds | May 10, 2025, 12:00:00 PM UTC | | huge | Huge date/time | Saturday, May 10, 2025, 12:00 PM UTC | | med | Medium date/time | May 10, 2025, 12:00 PM | | short | Short date/time | 5/10/25, 12:00 PM | | date_full | Full date | May 10, 2025 | | date / date_short | Short date | 5/10/2025 | | time | Simple time | 12:00 PM | | time24 | 24h time | 12:00 | | And many more... | | |

TypeScript Support

This module includes TypeScript definitions for all features.

License

MIT