Date Picker

View as Markdown

Summary

  • A Date Picker is provided by AdapTable whenever a date cell is edited
  • It is also used when filtering a date column
  • The Date Picker is highly configurable and themable

The Date Picker is automatically used by default in AdapTable when editing all Date cells.

Note

A Date cell is one where the Cell Data Type property for the column is date

It is also used when filtering any Date Column.

Hint

This can be changed by setting showDatePicker to false in Configuring Column Filters

The Date Picker is designed to be easily themable and can be heavily customised with CSS Variables.

Value Parser

If the Column Definition in AG Grid has a valueParser (provided as a function), that will be invoked before setting the value for the cell.

This is useful because dates can be stored as strings, numbers or Date instances, but the value parser will be called with a Date instance.

Hint

  • It's your responsibility to transform that value to the format required for persisting it to the grid
  • We strongly recommend you specify a colDef.valueParser function

Customising

The Date Picker is configured via dateInputOptions in User Interface Options.

useNativeInput

Default: false
boolean
Use the browser's date input instead of AdapTable's Date Picker

dateFormat

Default: yyyy-MM-dd
string
Format string for the date input field

locale

Default: en-US
Locale used to localise the Date Picker

showWeekNumber

Default: false
boolean
Show a week-number column in the Date Picker

showOutsideDays

Default: true
boolean
Show days that fall in the previous or next month

datepickerButtons

Default: ['close', 'today']

DatepickerButton[]

Buttons in the Date Picker footer, in display order
Date Picker Customising
Fork
  • This demo shows some ways to customise the AdapTable Date Picker (see adaptableOptions.ts)
    • The default Buttons have been set to Today, Yesterday and Next Workday
    • Show Week Numbering is on
    • Days not in the current month are hidden
Try It Out
  • Open the Date Picker in the Filter Bar for one of the Date columns and see how it looks
Loading demo…

Theming

The Date Picker can be fully styled - colours, look and feel, borders etc.

Date Picker Theming
Fork
  • This demo shows how to theme the AdapTable Date Picker using CSS variables in styles.css
Try It Out
  • Open the Date Picker in the Filter Bar for one of the Date columns and see how it looks
Loading demo…

Date Input Options

The options above cover the most common Date Picker settings.

The full property list for dateInputOptions is below.

The dateInputOptions class in UserInterfaceOptions contains many properties for managing the Date Picker:

Options for managing and customizing the date inputs.

PropertyTypeDescriptionDefault
dateFormatstringFormat string for formatting date input field'yyyy-MM-dd' (ISO 8601 format)
datepickerButtonsDatepickerButton[]List of buttons which are displayed in the datepicker overlay in the given order (provide empty array to display no buttons); custom button layout and positioning is achievable with the special elements - and |['close','today']
localeanyLocale object (to localize Date Picker)en-US
showOutsideDaysbooleanDisplay outside days (i.e. those falling in next or previous month)true
showWeekNumberbooleanDisplay the week numbers columnfalse
useNativeInputbooleanUse browser specific date input instead of AdapTable's Date Pickerfalse