1.4.17 • Published 3 years ago

vue-time-date-range-picker-vue3 v1.4.17

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

codecov

vue-time-date-range-picker

A Vue Component to pick a ranged datetime in calendar. Built alongside Vue 2.x . This datepicker utilize moment for translations.

Demo

codepen demo : https://codepen.io/limbara/pen/ZEQxoZZ sandbox demo : https://codesandbox.io/s/example-vue-time-date-range-picker-byw7g

Clone the repo and run 'npm install && npm run serve' for local demo

Install

npm i vue-time-date-range-picker

Usage

Usage within JS project

import DatePicker, { CalendarDialog } from 'vue-time-date-range-picker/dist/vdprDatePicker'

export default {
  //...
  components: {
    DatePicker,
    CalendarDIalog
  }
  //...
}

You can use CalendarDialog Component if you want to implement your own input element

Usage from CDN

<div id="app">
  <datepicker></datepicker>
</div>
<script src="https://unpkg.com/vue"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.27.0/moment-with-locales.min.js"></script>
<script src="https://unpkg.com/vue-time-date-range-picker@1.2.0/dist/vdprDatePicker.js"></script>
<script>
const app = new Vue({
  el: '#app',
  components: {
    'datepicker' : vdprDatePicker.default,
    'calendar-dialog' : vdprDatePicker.CalendarDialog
  }
})
</script>

Available props

Below is props that're available in DatePicker Component

date format refer to moment

PropTypeDefaultDescription
initial-datesDate, DateInitial value for the datepicker
inlineBooleanfalseUse datepicker inline style
languageStringenLanguange
formatStringDD/MM/YYYY HH:mmFormat for display date input
same-date-formatObjectrefer belowFormat for display date input if start & end date same
disabled-datesObjectrefer belowDisable certain dates
date-inputObjectInput configuration
show-helper-buttonsBooleanShow helper buttons
helper-buttons ObjectCustom helper button
calendar-date-inputObjectrefer belowCalendar input date configuration
calendar-time-inputObjectrefer belowCalendar input time configuration
switch-button-labelStringSwitch Button label
switch-button-initialBooleanSwitch Button initial value
apply-button-labelStringApply Button Label
reset-button-labelStringReset Button Label
is-monday-firstBooleanCalendar start from Monday instead of Sunday

Below is props that're available in Calendar Dialog Component

PropTypeDefaultDescription
initial-datesDate, DateInitial value for the datepicker
inlineBooleanfalseUse datepicker inline style
languageStringenLanguange
disabled-datesObjectrefer belowDisable certain dates
show-helper-buttonsBooleantrueShow helper buttons
helper-buttons Object Custom helper button
date-inputObjectCalendar input date configuration
time-inputObjectCalendar input time configuration
switch-button-labelStringAll DaysSwitch Button label
switch-button-initialBooleanfalseSwitch Button initial value
apply-button-labelStringApplyApply Button Label
reset-button-labelStringResetReset Button Label
is-monday-firstBooleanfalseCalendar start from Monday (default Sunday)

Same Date Format

Below is values that're available for props "same-date-format"

KeyTypeDefaultDescription
fromStringDD/MM/YYYY, HH:mmformat selected start date
toStringHH:mmformat selected end date

Date Input

Below is values that're available for props "date-input"

KeyTypeDefaultDescription
inputClassString|Array|Objectclass for input element
refNameStringref name for input element
nameStringattribute name
placeholderStringattribute placeholder
idStringatttibute id
requiredBooleanattirbute required

Disabled Dates

Below is values that're available for props "disabled-dates"

KeyTypeDefaultDescription
dates Datedisable dates matching array of Date object
fromDatedisable dates from this date
toDatedisable dates until this date
rangesObjectdisable dates matching object of date "from" & "to"
customFunctiondisable dates with function

Helper Buttons

Below is values that're available for props "helper-buttons"

KeyTypeDefaultDescription
nameStringbutton name
fromStringformat selected start date
toStringformat selected end date

C Date Input

Below is values that're available for props "calendar-date-input" or "date-input" for Calendar Dialog component

KeyTypeDefaultDescription
labelStartsStringStartsstart date label
labelEndsStringEndsends date label
inputClassString|Array|Objectclass for input element
formatStringDD/MM/YYYYdate format

C Time Input

Below is values that're available for props "calendar-time-input" or "time-input" for Calendar Dialog component

KeyTypeDefaultDescription
inputClassString|Array|Objectclass for input element
readonlyBooleanfalseattribute readonly
stepNumber60step value in minutes

Events

Below is events that're available in DatePicker Component

EventOutputDescription
date-appliedDate, DateDates is applied to date input. Output start & end date
on-prev-calendarOn calendar page previous
on-next-calendarOn calendar page next
datepicker-openedDatepicker is opened
datepicker-closedDatepicker is closed
select-dateDate, DateA date is selected in calendar. Output start & end date
select-disabled-dateDateA disabled date is selected in calendar

Below is events that're available in Calendar Dialog Component

EventOutputDescription
on-applyDate, DateDates is applied to date input. Output start & end date
on-prev-calendarOn calendar page previous
on-next-calendarOn calendar page next
select-dateDate, DateA date is selected in calendar. Output start & end date
select-disabled-dateDateA disabled date is selected in calendar

Translations

available languages refer to moment

1.4.15

3 years ago

1.4.17

3 years ago

1.4.16

3 years ago

1.4.14

3 years ago

1.4.9

3 years ago

1.4.11

3 years ago

1.4.10

3 years ago

1.4.13

3 years ago

1.4.12

3 years ago

1.4.8

3 years ago

1.4.7

3 years ago

1.4.6

3 years ago

1.4.5

3 years ago

1.4.4

3 years ago

1.4.3

3 years ago

1.4.2

3 years ago

1.4.1

3 years ago

1.4.0

3 years ago