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 🙏

© 2024 – Pkg Stats / Ryan Hefner

vue3-dayjs-plugin

v1.0.2

Published

A wrapper for integrating dayjs into Vuejs 3

Downloads

991

Readme

vue3-dayjs

NPM Version size license

A wrapper for integrating Day.js into Vue.js 3

Day.js is a minimalist JavaScript library that parses, validates, manipulates, and displays dates and times for modern browsers with a largely Moment.js-compatible API. If you use Moment.js, you already know how to use Day.js.

You can use Day.js without using this plugin

This plugin allows you to easily include Day.js globally. This is not recommended with Vue 3, and they recommend using provide/inject instead. But if you're just getting started with Day.js or know you prefer it global, you can use this plugin to make your coding life a bit easier.

Installation

npm install vue3-dayjs-plugin

Setup Globally

import VueDayjs from 'vue3-dayjs-plugin'

Vue.use(VueDayjs) // in your createApp call

Usage Example

Day.js will be available in your Vue templates using $date or $dayjs.

JS

    // you can call like this when using the old syntax
    this.$date('2018-08-08').format('DD/MM/YYYY');

    // when using the new <script setup> syntax you have to bring Day.js in manually
    // this means import Day.js into the script yourself or you can use the useDate composable included with this package.
    import { useDate } from 'vue3-dayjs-plugin/useDate';
    <script setup>
        const date = useDate();
        // then anywhere you need to use Day.js
        date('2018-08-08').format('DD/MM/YYYY');
    </script>
    // this is because global properties are not accessible within <script setup> :(

HTML

    <!-- this method of using Day.js ($date or $dayjs) will be globally available in all your components -->
    <div>{{ $date('2023-04-12').format('DD/MM/YYYY') }}</div>
    <div>{{ $dayjs('2023-04-12').format('DD/MM/YYYY') }}</div>

License

MIT