0.1.1 • Published 2 years ago

@nerd305/vuetify-date-range-picker v0.1.1

Weekly downloads
230
License
MIT
Repository
github
Last release
2 years ago

Vuetify Date Range Picker

Date Range Picker component build with Vuetify, optimized for best mobile and desktop user experience.

Install

npm install @nerd305/vuetify-date-range-picker
import DateRangePicker from "@nerd305/vuetify-date-range-picker"

export default {
  // ...
  components: {
    DateRangePicker,
  },
  // ...
}

Usage

<date-range-picker :config="configuration" @change="setDateRange" />

example configuration using last 30 days preset and compare to previous period:

<script>
  import { presets } from "@nerd305/vuetify-date-range-picker"

  const configuration = {
    dark: false,
    compare: true,
    dateFormat: "MMM Do, YYYY",
    dateStart: presets.LAST_30_DAYS[0],
    dateUntil: presets.LAST_30_DAYS[1],
    compareStart: presets.PREVIOUS_PERIOD[LAST_30_DAYS][0],
    compareUntil: presets.PREVIOUS_PERIOD[LAST_30_DAYS][1],
    primaryPreset: LAST_30_DAYS,
    comparePreset: PREVIOUS_PERIOD,
  }
</script>

Available props

PropTypeDefaultDescription
configObjectconfigurationDate format of the DateRangePicker
Object propertyTypeDefaultDescription
darkBooleanfalsedark theme for DateRangePicker
compareBooleanfalseturn on/off comare period
dateFormatStringMM-DD-YYYYDate format of the DateRangePicker
dateStartSTRINGDAYS_AGO_77 days ago
dateUntilSTRINGTODAYtoday
compareStartSTRINGDAYS_AGO_157 prior days from dateStart
compareUntilSTRINGDAYS_AGO_87 prior days from dateuntil
primaryPresetSTRINGLAST_WEEKconstant name representing last week
comparePresetSTRINGPREVIOUS_PERIODconstant name representing previous 7 days from primary preset selection

Events

These events are emitted on actions in the datepicker

EventOutputDescription
changeObjectDate Range Picker date range selections, selected preset, comparison period, as described in above configuration object
openedBooleanemits true if the component is engaged and false when not

Date formatting

String formatter

Should be parsing and using date string format as in moment package.

TokenDescExample
dday1
dd0 prefixed day01
Dabbr dayMon
sudate suffixst, nd, rd
Mmonth number (1 based)1 (for Jan)
MM0 prefixed month01
MMMabbreviated month nameJan
MMMMmonth nameJanuary
yytwo digit year16
yyyyfour digit year2016

Presets

Static presets

Used for primary date range selection

  • LAST_WEEK
  • LAST_MONTH
  • LAST_7_DAYS
  • LAST_30_DAYS

Computed presets

Used for compare date range selection based on primary date range selection

  • PREVIOUS_PERIOD
  • PREVIOUS_YEAR
0.1.0

2 years ago

0.1.1

2 years ago

0.0.53

3 years ago

0.0.52

3 years ago

0.0.51

3 years ago

0.0.50

3 years ago

0.0.41

3 years ago

0.0.42

3 years ago

0.0.43

3 years ago

0.0.44

3 years ago

0.0.45

3 years ago

0.0.40

3 years ago

0.0.37

3 years ago

0.0.38

3 years ago

0.0.39

3 years ago

0.0.36

3 years ago

0.0.35

3 years ago

0.0.34

3 years ago

0.0.33

3 years ago

0.0.32

3 years ago

0.0.31

3 years ago

0.0.25

3 years ago

0.0.30

3 years ago

0.0.26

3 years ago

0.0.27

3 years ago

0.0.28

3 years ago

0.0.29

3 years ago

0.0.20

3 years ago

0.0.21

3 years ago

0.0.22

3 years ago

0.0.23

3 years ago

0.0.15

3 years ago

0.0.16

3 years ago

0.0.17

3 years ago

0.0.18

3 years ago

0.0.19

3 years ago

0.0.14

3 years ago

0.0.13

3 years ago

0.0.12

3 years ago

0.0.10

4 years ago

0.0.11

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago