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

days-calendar

v1.5.4

Published

Simple and customizable calender components for Vue

Downloads

11

Readme

Days Calendar

Simple and customizable calender for Vue, which only used moment.js and no more other dependencies.

This project still under active development, please feel free to open issues or pull request.

Demo

http://days.sardo.work/

Features

  • Customizable days and weekdays output
  • Customizable style

Installation

npm install days-calendar --save

or

yarn add days-calendar

Usage

Import module from days-calendar, then register it to Vue:

Base

import DaysCalendar from 'days-calendar';

new Vue({
  el: '#your-dom-element',
   components: {
      Calendar: DaysCalendar
   }
})

Custom Modal

By default, Days Calendar will show a modal which contain event content. If you want to custom the template of modal, you can call calendar like this:

   <Calendar>
     <div slot="modal-content">
       <h1>Hello World!</h1>
     </div>
   </Calendar>

If you want to using day object in custom modal, you should pass renderDay function to calendar like this:

<Calendar :renderDay="getDate">
 <div slot="modal-content">
   {{day.content}}
 </div>
</Calendar>
getDate: function(day){
  this.day = day;
  return day;
}

or you will not be allow to access the information of day.

Disable Day

If you don't want user click on some day, you can pass renderDays function to calendar like this:

<Calendar :renderDays="renderDays"></Calendar>
renderDays: function(days){
  return new Promise((resolve, reject) => {
    for(let i = 0; i < days.length; i++){
      const weekday = days[i].date.weekday();
      //If it is Tuesday, disable it
      if(weekday == 2){
        days[i].disabled = true;
      }
    }
     resolve(days);
  });
},

Props

langcode (optional)

A string of language code which used to setting calendar language. Support language:

  1. English - en
  2. Traditional Chinese (Hong Kong) - zh-hk
  3. Traditional Chinese (Taiwan) - zh-tw
  4. Simplified Chinese - zh-cn

Default value is en.

defaultStart (optional)

A string which tell calendar should start on that date. Format is YYYY-MM-DD.

Default value is current date.

Example: 2017-11-03

renderDay (optional)

If you pass this props to Days Calendar, it will pass day object to the function before render the content.

This function should return a day object array.

renderDay(day){
  console.log(day);
  return day;
}

/* Day object:
{ number: (Number of that day), date: (Moment Date Object), class: [] } */

renderDays (optional)

If you pass this props to Days Calendar, it will pass the array of day object to the function before render the content.

This function should return promise which resolve days array or error.

renderDays(year, month, days){
  return new Promise((resolve, reject) => {
     //Do something
     resolve(days);
  });
}

onClick (optional)

If you pass this props to Days Calendar, it will pass the day object to the function before render the content. It will allow you control the behavior after click on any day.

onClick(day){
  console.log('This day is:', day);
}

Contributing

You can clone this repository then start develop at sandbox, or feel free to open issue on github.

Build package:

npm run build

Watch package change and build it:

npm run watch