Date Picker
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.valueParserfunction
Customising
The Date Picker is configured via dateInputOptions in User Interface Options.
useNativeInput
Default: falsebooleandateFormat
Default: yyyy-MM-ddstringlocale
Default: en-USshowWeekNumber
Default: falsebooleanshowOutsideDays
Default: truebooleandatepickerButtons
Default: ['close', 'today']DatepickerButton[]
- This demo shows some ways to customise the AdapTable Date Picker (see
adaptableOptions.ts)- The default Buttons have been set to
Today,YesterdayandNext Workday - Show Week Numbering is on
- Days not in the current month are hidden
- The default Buttons have been set to
- Open the Date Picker in the Filter Bar for one of the Date columns and see how it looks
Theming
The Date Picker can be fully styled - colours, look and feel, borders etc.
- This demo shows how to theme the AdapTable Date Picker using CSS variables in
styles.css
- Open the Date Picker in the Filter Bar for one of the Date columns and see how it looks
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.
| Property | Type | Description | Default |
|---|---|---|---|
| dateFormat | string | Format string for formatting date input field | 'yyyy-MM-dd' (ISO 8601 format) |
| datepickerButtons | DatepickerButton[] | 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'] |
| locale | any | Locale object (to localize Date Picker) | en-US |
| showOutsideDays | boolean | Display outside days (i.e. those falling in next or previous month) | true |
| showWeekNumber | boolean | Display the week numbers column | false |
| useNativeInput | boolean | Use browser specific date input instead of AdapTable's Date Picker | false |