2.4.3 • Published 6 years ago

vue-datepicker-persian v2.4.3

Weekly downloads
40
License
MIT
Repository
github
Last release
6 years ago

vue-datepicker-persian

A Persian Datepicker Component For Vue2

Demo

image

Install

$ npm install vue-datepicker-persian --save

Usage

<script>
import DatePicker from 'vue-datepicker-persian'

export default {
  components: { DatePicker },
  data() {
    return {
      time1: '',
      time2: '',
      time3: '',
      shortcuts: [
        {
          text: 'Today',
          onClick: () => {
            this.time3 = [ new Date(), new Date() ]
          }
        }
      ],
      timePickerOptions:{
        start: '00:00',
        step: '00:30',
        end: '23:30'
      }
    }
  }
}
</script>

<template>
  <div>
    <date-picker v-model="time1" :first-day-of-week="1"></date-picker>
    <date-picker v-model="time2" type="datetime" :time-picker-options="timePickerOptions"></date-picker>
    <date-picker v-model="time3" range :shortcuts="shortcuts"></date-picker>
  </div>
</template>

Props

PropTypeDefaultDescription
typeString'date'select date type (date/datetime/year/month/time)
rangeBooleanfalseif true, the type is daterange or datetimerange
formatStringYYYY/MM/DDThe parsing tokens are similar to the moment.js
langString/ObjectfaTranslation (fa)(custom)
clearableBooleantrueif false, don't show the clear icon
confirmBooleanfalseif true, need click the button to change the value
editableBooleantrueif false, user cann't type it
disabledBooleanfalseDisable the component
placeholderStringinput placeholder text
widthString/Number210input size
not-beforeString/Date''Disable all dates before new Date(not-before)
not-afterString/Date''Disable all dates after new Date(not-after)
disabled-daysArray/function[]Disable Days
shortcutsBoolean/Arraytruethe shortcuts for the range picker
time-picker-optionsObject{}set timePickerOptions(start, step, end)
minute-stepNumber0if > 0 don't show the second picker(0 - 60)
first-day-of-weekNumber7set the first day of week (1-7)
input-classString'mx-input'the input class name
input-nameString'date'the input name attr
confirm-textString'OK'the default text to display on confirm button
range-separatorString'~'the range separator text
date-formatString''format the time header and tooltip

shortcuts

PropTypeDescription
textStringText
startDateStart Date
endDateEnd Date
onClickFunctionclick handler

time-picker-options

PropTypeDescription
startStringstartTime (eg '00:00')
stepStringstepTime (eg '00:30')
endStringendTime (eg '23:30')

Events

NameDescriptionCallback Arguments
changeWhen the value changethe currentValue
inputWhen the value changethe currentValue
confirmWhen click 'OK' buttonthe currentValue
clearWhen click 'clear' button
input-errorWhen user type a invalid Datethe input text

Slots

NameDescription
calendar-iconcustom the calender icon
headerpopup header
footerpopup footer

Thanks

This component is a forked branch of mengxiong10's vue2-datepicker datepicker component

License

MIT

Copyright (c) 2017-present MostafaTech