Skip to main content
Version: 1.16.0

DatePicker

Overview

The DatePicker component allows the user to display a input area and date selection calendar.


Specification

Property

Here is a list of properties that can be used for modifying the component:

NameTypeDefaultDescriptionRemark
classNamestring""Component class name
errorstring""Text to be displayed in errorError will not be displayed if unspecified or left empty
idstring""Component id name
labelstring""Label for the componentLabel will not be displayed if unspecified or left empty
language *1string"auto"Language settingAvailable options: "auto", "en", "ja", "zh", "zh-TW"
If setting "auto", it will be according to the HTML lang setting (If the lang setting is other than "en"/"zh"/"zh-TW"/"ja", the language setting will be "en")
valuestring""Text to be displayedFormat is YYYY-MM-DD
The below date can be used (it will be converted to YYYY-MM-DD internally):
  • 2021
  • 2021-1
  • 2021-01
  • 2021-1-9
  • 21-01-01
  • If the year is less than 4 characters, 0 will be added to the beginning
    If the date and/or month is ignored, it will be supplemented with 01
    If the date and/or month has only 1 character, 0 will be added to the beginning
    Will result an error if setting invalid format or value
    disabledbooleanfalseEnable/Disable the component
    requiredIconbooleanfalseShow/Hide the required icon
    visiblebooleantrueShow/Hide the component
    info

    *1: The displayed date format is automatically switched depending on the language property setting as follows:

    • "en": MM/DD/YYYY
    • "ja", "zh", "zh-TW": YYYY-MM-DD

    Event

    Here is a list of events that can be specified:

    NameTypeDescriptionRemark
    changefunctionEvent handler when the value has been changedIt will pass the event object as the argument

    You can receive the following values in event.detail
    event.detail.oldValue : Value before the change
    event.detail.value : Value after the change

    Constructor

    DatePicker(options)
    Here is a list of available constructors:

    Parameter

    NameTypeDefaultDescriptionRemark
    optionsobject{}Object that includes component properties

    Custom CSS

    tip

    Please check Custom CSS feature guide at first.

    Here is a list of properties that can be used for modifying component style:

    Property

    Name
    --kuc-date-picker-input-width
    --kuc-date-picker-input-height
    --kuc-date-picker-input-color
    --kuc-date-picker-input-font-size

    Sample Code

    tip

    Please check the package installation method first.

    Here is a sample code when all parameters are specified:

    const Kuc = Kucs['1.x.x'];

    const space = kintone.app.record.getSpaceElement('space');

    const datePicker = new Kuc.DatePicker({
    label: 'Date',
    requiredIcon: true,
    language: 'auto',
    value: '2021-11-11',
    error: 'Error occurred!',
    className: 'options-class',
    id: 'options-id',
    visible: true,
    disabled: false
    });
    space.appendChild(datePicker);

    datePicker.addEventListener('change', event => {
    console.log(event);
    });