Socket
Socket
Sign inDemoInstall

vue-mj-daterangepicker-custom-presets

Package Overview
Dependencies
595
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    vue-mj-daterangepicker-custom-presets


Version published
Maintainers
1
Created

Readme

Source

vue-mj-daterangepicker

Size Limit example

Installation

You need Vue.js version 2.0+.

1 Install via npm

npm install vue-mj-daterangepicker
yarn add vue-mj-daterangepicker

2 Import and use

import Vue from 'vue'
import DateRangePicker from 'vue-mj-daterangepicker'
import 'vue-mj-daterangepicker/dist/vue-mj-daterangepicker.css'

...

Vue.use(DateRangePicker)

Props

NameTypeDefaultDescription
localeStringenset the locale ['de', 'es', en', 'fr', 'ru']
fromStringnullISO-8601 date of start range
toStringnullISO-8601 date of end range
beginStringnullISO-8601 date to display since beginning range
allowFromStringnullISO-8601 date to disable selection of all dates before (strict)
allowToStringnullISO-8601 date to disable selection of all dates after (strict)
pastBooleantrueallow/disallow user to select past dates
futureBooleantrueallow/disallow user to select future dates
panelStringnullchoose which panel to be open by default
panelsArray[ 'range', 'week', 'month', 'quarter', 'year' ]choose which panels to be available
yearsCountNumber2number of past/future years to display in year panel
showControlsBooleantrueshow bottom controls
themeObjectsee customize sectioncustomize colors
widthString'auto'set component width
resetTitleString'Reset'change Reset button title
submitTitleString'Submit'change Submit button title
presetsObjectsee preset sectionselect which presets to be available
rangeDisplayedString'to'select which range is visible when calendar is displayed

Customize

theme = {
  primary: '#3297DB',
  secondary: '#2D3E50',
  ternary: '#93A0BD',
  border: '#e6e6e6',
  light: '#ffffff',
  dark: '#000000',
  hovers: {
    day: '#CCC',
    range: '#e6e6e6'
  }
}

Presets

available presets : ['custom', 'today', 'yesterday', 'tomorrow', 'last7days', 'next7days', 'last30days', 'next30days', 'last90days', 'next90days', 'last365days', 'next365days', 'forever']

warning: forever need begin props to be set.

Events

This datepicker emit three events, @update, @select and @reset

@update is triggered when submit button is clicked. @select is triggered when a range is selected, can be useful if you don't want to show bottom controls (with showControls = false) @reset is triggered when reset button is clicked

All return an object with the start and end date, plus the active panel

{
  to: '2019-04-23T10:26:00.996Z',
  from: '2018-04-23T10:26:00.996Z'
  panel: 'range'
}

Examples

<template>
  <date-range-picker :from="$route.query.from" :to="$route.query.to" :panel="$route.query.panel" @update="update"/>
</template>

<script>

export default {
  methods: {
    update(values) {
      this.$router.push({ query: Object.assign({}, this.$route.query, {
        to: values.to,
        from: values.from,
        panel: values.panel
      }) })
    }
  }
}
</script>

Keywords

FAQs

Last updated on 04 Aug 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc