0.1.0 • Published 1 year ago

@heumlabs/vue-datepicker v0.1.0

Weekly downloads
-
License
-
Repository
-
Last release
1 year ago

Heumlabs Vue Datepicker

npm version

Install via npm

npm install @heumlabs/vue-datepicker

Usage

Usage

<script lang="ts" setup>
  import { DatePicker } from '@heumlabs/vue-datepicker';
  import '@heumlabs/vue-datepicker/dist/style.css';
  
  // all date will be converted to start of the day (ex. '1995-12-17T00:00:00')
  const startDate = new Date('1995-12-17T03:24:00');
  const endDate = new Date('1995-12-23T03:24:00');
  
  const disableDatesAfter = new Date('1995-12-26T18:24:00');
  
  const customCurrentDate = new Date('1995-12-25T13:07:00');
  
  const onSelect = (dateString: string) => {
    console.log(dateString) // '2023-01-01'
  }
</script>

<template>
  <div>
    <DatePicker
      :year="2023"
      :month-index="0"
      :start-date="startDate"
      :end-date="endDate"
      :current-date="customCurrentDate"
      :disable-dates-after="disableDatesAfter"
      @select="onSelect"
    />
  </div>
</template>

API

DatePicker

Props

NameDescriptionTypeRequiredDefault
yearyear to shownumberyes
monthIndexmonth to show (0 ~ 11)numberyes
headerFormatheader text formatstringno'YYYY.M'
dayLabelsday labels start from sundaystring[]no['Sun','Mon','Tue','Wed','Thu','Fri','Sat']
todayLabeltext shown below todaystringno'Today'
startDatestart date for select rangeDateno
endDateend date for select rangeDateno
selectedDatesdates to show selectedDate[]no[]
currentDateto customize current date to show today on different dateDatenonew Date()
disableDatesAftershow dates disabled after disableDatesAfterDateno
disableDatesBeforeshow dates disabled before disableDatesBeforeDateno

Events

NameDescriptionParameters
selectdate click event. dateString format: 'YYYY-MM-DD'dateString: string, event: Event

DateInput

Props

NameDescriptionTypeRequiredDefault
labelinput label textstringyes
valueformatted date string ('YYYY-MM-DD') or empty string if input string value is invalidstringyes
disableDatesAfterproperty for validationDateno
disableDatesBeforeproperty for validationDateno

Events

NameDescriptionParameters
inputdate input event. dateString format: 'YYYY-MM-DD'dateString: string
focusinput focus event.event: Event
blurinput blur event.event: Event

Changelog

All notable changes to this project will be documented in the Releases Page.

License

The MIT License. Please see for more information.

Thanks to

0.1.0

1 year ago

0.0.5

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago