1.0.4 • Published 7 months ago

@craydel/craydel-date-picker v1.0.4

Weekly downloads
-
License
MIT
Repository
-
Last release
7 months ago

CraydelDatePicker

Installation

Get the latest version by NPM:

$ npm i @craydel/craydel-date-picker

Register Plugin

If you use the plugin API, the component will be registered as a global component just like when including it with the script tag, but you won't need to re-register it through the components property in your own components.

Create the plugin file e.g craydel-components.js file.

// craydel-components.js
import Vue from 'vue'
import CraydelDatePicker from '@craydel/craydel-date-picker/src/CraydelDatePicker.vue'

const Components = {
  CraydelDatePicker,
};

Object.keys(Components).forEach(name => {
  Vue.component(name, Components[name]);
});

export default Components;

Next reference the plugin file in your nuxt.config.js

// Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
plugins: [
  '~/plugins/craydel-components.js'
]

Props

NameTypeDefaultDescription
idstringrandom IDSets the DOM id on the component.
placeholderstring'DD/MM/YYYY'Sets the component's placeholder text.
is-requiredbooleanfalsePuts component in a required state.
required-errorstring'Field is required'Puts the component in an error state and passes through the custom required error message.
minstringundefinedMinimum allowed date/month (ISO 8601 format)
maxstringundefinedMaximum allowed date/month (ISO 8601 format)
hintstringundefinedHint text.
attachstringundefinedSpecifies which DOM element that this component should detach to. String can be any valid querySelector. This will attach to the root v-app component by default.
no-validationbooleanfalseRemoves the validation styling from the component.
disabledbooleanfalseDisables the component.

Events

NameDescription
changeChange event is emitted only when the day (for date pickers) or month (for month pickers) changes.

Usage

An example showing a date picker for a birthday, restricting dates range.

<craydel-date-picker
        placeholder="Date of birth"
        min="1950-01-01"
        :max="(new Date(Date.now() - (new Date()).getTimezoneOffset() * 60000)).toISOString().substring(0, 10)"
></craydel-date-picker>
1.0.4

7 months ago

1.0.3

8 months ago

1.0.2

8 months ago

1.0.1

8 months ago

1.0.0

8 months ago