DateTime

Show Date and Time in Calendary way or use as a Picker to select one

Installation

npm install --save @gladio/datetime

Usage

import DateTime from "@gladio/datetime"
function App () {
return <DateTime />
}

Components

Following components are exported from @gladio/datetime module.

DateTime

DateTime component is the base component which allows selection of dates and times. Date format can be passed with a combination of dateFormat and timeFormat props. Passing any of them as true enable that type of component and setting it to false disable that type.

dateFormat defaults to true whereas timeFormat defaults to false

A string value can also be passed as the format for these props e.g. dateFormat="DD MMM, YYYY", timeFormat="HH:mm A".

Code Editor
July 2021
SuMoTuWeThFrSa
27282930123
45678910
11121314151617
18192021222324
25262728293031
12:00 AM

DateTimeInput

Instead of using a native <input type="date" />, you can use the DateTimeInput component which render a input with the DateTime component. Native inputs have different UI/UX and are not will supported. You can pass all other props accepted by DateTime base component like formats, value, onChange etc.

Code Editor

DateTimePicker

To have a fine control over what is rendered by the DateTimeInput, we can use the DateTimePicker component that let's you render a customized component as the toggler. It default to rendering a button component.

Code Editor
Select a date

Playground

Code Editor