1.2.0 • Published 3 years ago

quasar-ui-calender-touch v1.2.0

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

DateTimeRangePicker

Date time range picker component based on Flatpickr and Quasar. Contains flatpickr wrapper and date-time picker.

Installation

# npm
npm install git+https://github.com/flespi-software/DateTimeRangePicker.git --save

Prerequisites:

Run examples on your localhost

  • Clone this repo
  • You should have quasar (^0.17.0) pre-installed
  • Install dependencies npm install
  • Run webpack dev server quasar dev
  • This should open the demo page at http://localhost:8080 in your default web browser

DateTimeRangePicker component

Screenshot

Features

  • ES6 Javascript
  • Vue.js
  • Writing .vue files
  • Rollup
  • NPM ecosystems

Usage

In quasar.config.js

  framework: {
    components: [
      'QBtnToggle'
    ]
  }
<template>
  <div>
    <date-range v-model="date"/>
  </div>
</template>

<script>
  import DateRange from 'datetimerangepicker'

  export default {
    data () {
      return {
        date: [new Date()],
      }
    },
    components: {
      DateRange
    }
  }
</script>

Available props

The component accepts these props:

AttributeTypeDefaultDescription
v-model / valueArray[new Date()]RangeValue (required)
modeNumber{0,1,2,3,4}0Component mode: 0 - Single date picker, 1 - week picker, 2 - month picker, 3 - custom range picker, 4 - manual formated or timestamp mode
themeObject{color:'grey-9', bgColor:'white', modeSwitch:true}color - text color, bgColor - background color, modeSwitch - need show switch mode buttons

Available events

The component accepts these props:

EventPayloadDescription
inputArraySelected dates timestamps array
errorBooleanError in time range.
change:modeNumberNew component mode

Flatpickr wrapper

Screenshot

Usage

<template>
  <div>
    <vue-flat-pickr v-model="date" :config="config" />
  </div>
</template>

<script>
  import { VueFlatPickr } from 'datetimerangepicker'

  export default {
    data () {
      return {
        date: new Date(),
        config: {
          wrap: true, // set wrap to true only when using 'input-group'
          altFormat: 'M j, Y',
          altInput: true,
          dateFormat: 'Y-m-d',
          locale: Hindi, // locale for this instance only
        }
      }
    },
    components: {
      VueFlatPickr
    }
  }
</script>

Events

  • The component can emit all possible events, you can listen to them in your component
<vue-flat-pickr v-model="date" @on-change="doSomethingOnChange" @on-close="doSomethingOnClose" />
  • Events names has been converted to kebab-case.
  • You can still pass your methods in :config like original flatpickr do.

Available props

The component accepts these props:

AttributeTypeDefaultDescription
v-model / valueString / Date Object / Array / Timestamp / nullnullDate-picker value (required)
configObject{wrap:false}Flatpickr configuration options
eventsArrayArray of useful eventsCustomise the events to be emitted
themeObject{color:'grey-9', bgColor:'white'}color - text color, bgColor - background color

License

MIT License

1.2.0

3 years ago