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

vue2-baremetrics-calendar

v1.6.1

Published

<h1 align="center">Vue Baremetrics Calendar</h1>

Downloads

211

Readme

A Vue.js wrapper for the beautiful date-range picker made by the Baremetrics team.


The Vue-Baremetrics date range picker is a simplified solution for selecting both date ranges and single dates all from a single calender view. With a revamped minimalistic redesign.

Redesigned and Wrapped for Vue.js by Divyansh Tripathi

View a demo

NPM Package

Installation

npm i --save vue2-baremetrics-calendar

Usage

Global Usage

Global Registeration via Vue.use() method.

// main.js
import Vue from "vue";
import App from "./App.vue";
import router from "./router";
// import the plugin
import Calendar from "vue2-baremetrics-calendar";

Vue.config.productionTip = false;

// use the plugin
Vue.use(Calendar);

new Vue({
  router,
  render: h => h(App)
}).$mount("#app");

Once registered you can use the component in its default settings with as follows:-

<Calendar
  type="double"
  @rangeEdit="processDateRange()"
  elementName="doubleRangePicker"
/>

<Calendar
  type="single"
  @dateEdit="processDate()"
  elementName="singleRangePicker"
/>

REMEMBER elementName is the only required prop and it should be different for each datepicker in your component

<template>
  <div id="app">
    <Calendar
      @rangeEdit="processOutput"
      type="double"
      elementName="otherRangePicker"
    />

    <Calendar
      @dateEdit="processOutput"
      type="single"
      elementName="primaryRangePicker"
    />
  </div>
</template>

<script>
  import Calendar from "./components/Calendar";
  export default {
    components: {
      Calendar
    },
    methods: {
      processOutput(output) {
        console.log(output);
      }
    }
  };
</script>

Events Emitted -

| Name | Type | Output | Description | | ---------- | ------ | ---------------------------------- | -------------------------------- | | dateEdit | double | [Timestamp(begin), Timestamp(end)] | Array of start date and end date | | dateEdit | single | Timestamp | Selected date Timestamp |

Base Calendar Props

  • elementName *required [string]
    • DOM object of the calendar div you're working on
  • earliest_date [date YYYY-MM-DD]
    • The earliest date to show in the calendar
  • latest_date [date YYYY-MM-DD]
    • The latest date to show in the calendar
  • format [object]
    • Object containing formatting strings for.. you guessed it.. formatting your dates
      format: {
        input: 'MMMM D, YYYY', // Format for the input fields
        jump_month: 'MMMM', // Format for the month switcher
        jump_year: 'YYYY' // Format for the year switcher
      }
  • days_array [array]
    • Array of the 7 strings you'd like to represent your days in the calendar
    days_array: ["S", "M", "T", "W", "T", "F", "S"];

Single Calendar Props

  • current_date [date YYYY-MM-DD]
    • The date to start the calendar on
  • required [boolean]
    • Toggle if this field must have always have a valid selected date
  • placeholder [string]
    • Set placeholder text (note this will only apply if the required key is set to false). The default will be whatever moment date format you're using. (i.e. 'M/D/YYYY')

Double Calendar Props

  • start_date [date YYYY-MM-DD]
    • The date to start the selection on for the calendar
  • end_date [date YYYY-MM-DD]
    • The date to end the selection on for the calendar
  • same_day_range [boolean]
    • Allow a range selection of a single day
  • format [preset key in format object] // see above
    • The double calendar adds the preset key to the format object for formatting the preset dates in the preset dropdown
  • presets [boolean] or [object]
    • If you don't want to show the preset link just set this to false otherwise the default is true which will just give you a basic preset of.. yep.. presets. BOOM!
    • Otherwise, if you want to customize it up you can include an array of preset objects. Something like:
    presets: [
      {
        label: "Last month",
        start: moment()
          .subtract(1, "month")
          .startOf("month"),
        end: moment()
          .subtract(1, "month")
          .endOf("month")
      },
      {
        label: "Last year",
        start: moment()
          .subtract(1, "year")
          .startOf("year"),
        end: moment()
          .subtract(1, "year")
          .endOf("year")
      }
    ];