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

vue-date-now

v1.1.2

Published

Plugin to work with dates in vue.

Downloads

21

Readme

vue-date-now

Easily work with dates using the available methods.

Feel free to collaborate. I would like to expand translations, so if you dare! 🚀

npm npm bundle size (minified + gzip) npm dependencies Status HitCount NpmLicense

 

Install with npm:

npm install vue-date-now

or install with yarn

yarn add vue-date-now

 

Enable it in your project:

import VueDateNow from 'vue-date-now';
    
Vue.use(VueDateNow);

 

Use the available methods:

export default {
    name: 'app',
    data () {
        return {
            year: this.$dn.year(),
            monthText: this.$dn.monthText()
        }
    }
}

 

Documentation

Notes:

    This documentation has been created on 2019-06-17.

    The monthText method supports all languages thanks to the toLocaleString() method of js

 

Languages available for howLong and dayText methods:

| Slug | Language | |:-----|:----------------| | es | Spanish | | en | English |

 

Methods


@ date()

# Parameters (3)
    1. # date
  • Required: false
  • Type: Date Object
  • Default: new Date()
  • Description: You can specify the date by passing this parameter with an instance of the Date object.
    2. # format
  • Required: false
  • Type: String
  • Default: 'yyyy-mm-dd'
  • Description: You can specify the format by passing it a string.
    3. # separator
  • Required: false
  • Type: String
  • Default: '/'
  • Description: You can specify the separator by passing it a string.
$ How to use
this.$dn.date(new Date(), 'dd-mm-yyyy', '-') // result = 17-06-2019
this.$dn.date(new Date(), 'dd-mm-yyyy') // result = 17/06/2019
this.$dn.date(new Date()) // result = 2019/06/17
this.$dn.date() // result = 2019/06/17

@ howLong()

# Parameters (2)
    1. # date
  • Required: true
  • Type: Date Object || date String || timestamp String
  • Description: It is required to specify the date to obtain the time since then.
    2. # language
  • Required: false
  • Type: String
  • Default: 'en'
  • Description: You can specify the language by passing it a string.
$ How to use
this.$dn.howLong(new Date('2019-04-08'), 'en') // result = A few months ago
this.$dn.howLong('2016-04-22', 'en') // result = More than a year ago
this.$dn.howLong('2019-06-17 10:56:47', 'es') // result = Hace unas horas

@ year()

# Parameters (1)
    1. # date
  • Required: false
  • Type: Date Object || date String || timestamp String
  • Default: ''
  • Description: You can specify the date by passing this parameter with an instance of the Date object.
$ How to use
this.$dn.year(new Date()) // result = 2019
this.$dn.year('2016-04-22') // result = 2016
this.$dn.year('2014-04-22 22:56:47') // result = 2014
this.$dn.year() // result = 2019

@ month()

# Parameters (1)
    1. # date
  • Required: false
  • Type: Date Object || date String || timestamp String
  • Default: ''
  • Description: You can specify the date by passing this parameter with an instance of the Date object.
$ How to use
this.$dn.month(new Date()) // result = 06
this.$dn.month('2016-04-22') // result = 04
this.$dn.month('2014-02-14 22:56:47') // result = 02
this.$dn.month() // result = 06

@ monthText()

# Parameters (2)
    1. # date
  • Required: false
  • Type: Date Object || date String || timestamp String
  • Default: ''
  • Description: You can specify the date by passing this parameter with an instance of the Date object.
    2. # language
  • Required: false
  • Type: String
  • Default: 'en'
  • Description: You can specify the language by passing it a string.
$ How to use
this.$dn.monthText(new Date(), 'en') // result = June
this.$dn.monthText('2016-01-22', 'es') // result = Enero
this.$dn.monthText('2014-03-22 22:56:47', 'es') // result = Marzo
this.$dn.monthText('', 'en') // result = June
this.$dn.monthText() // result = June

@ day()

# Parameters (1)
    1. # date
  • Required: false
  • Type: Date Object || date String || timestamp String
  • Default: ''
  • Description: You can specify the date by passing this parameter with an instance of the Date object.
$ How to use
this.$dn.day(new Date()) // result = 2
this.$dn.day('2016-04-22') // result = 6
this.$dn.day('2014-02-14 22:56:47') // result = 3
this.$dn.day() // result = 2

@ dayText()

# Parameters (2)
    1. # date
  • Required: false
  • Type: Date Object || date String || timestamp String
  • Default: ''
  • Description: You can specify the date by passing this parameter with an instance of the Date object.
    2. # language
  • Required: false
  • Type: String
  • Default: 'en'
  • Description: You can specify the language by passing it a string.
$ How to use
this.$dn.dayText(new Date(), 'en') // result = Monday
this.$dn.dayText('2016-01-22', 'es') // result = Viernes
this.$dn.dayText('2014-03-22 22:56:47', 'es') // result = Sábado
this.$dn.dayText('', 'en') // result = Monday
this.$dn.dayText() // result = Monday

@ diff()

# Parameters (3)
    1. # date
  • Required: true
  • Type: Date Object || date String || timestamp String
  • Description: It is required to specify the most current date of the comparison.
    2. # date
  • Required: true
  • Type: date String || timestamp String
  • Description: It is required to specify the oldest date of comparison.
    3. # type
  • Required: false
  • Type: String
  • Default: 'days'
  • Available values: 'seconds', 'minuts', 'hours', 'days', 'weeks', 'months', 'years'
  • Description: You can specify the type of data to return.
$ How to use
this.$dn.diff(new Date(), '2016-08-21', 'years') // result = 2.8
this.$dn.diff('2019-03-15', '2016-08-21', 'months') // result = 31.2
this.$dn.diff('2019-03-15', '2016-08-21') // result = 936.0

@ time()

# Parameters (0)
    0. # without parameters
$ How to use
this.$dn.time() // result = 18:31:48