- Print
- DarkLight
Date Picker
- Print
- DarkLight
The Date Picker is a versatile tool that allows users to select dates and times with timezone support. It includes features such as:
Relative mode for selecting dates relative to the current date
Calendar selection for picking specific dates
Relative shortcuts for quick date selection
Timezone selection to accommodate different time zones
Production date handling for managing production schedules
Configuration Options
The picker can be configured through the following options:
Option | Type | Default | Description | Options |
|---|---|---|---|---|
| string |
| The default mode of the date picker. |
|
| string[] |
| The units available for relative selection. (i.e. Last 7 Days) |
|
| boolean | true | Show/hide toggle for switching between relative and absolute mode. | |
| boolean | true | Show/hide relative picker. | |
| boolean | true | Enable/Disable time in absolute mode. | |
| boolean | false | Show/hide relative quarter shortcuts. | |
| boolean | false | Show/hide time zone selection. | |
| boolean | false | If true, extra parameters will be passed to the UDF | |
| number | 7 | The default relative value to use. | |
| string |
| The default unit of time for the relativeAmount. |
|
| string | user local time | The selected time zone. | any IANA Timezones e.g. |
| any | null | The selected shortcut, if any. |
|
| string |
| The default timeType selection. |
|
Basic Example:
{
"config": {
"enableTimeTypeSelection": true,
"mode": "relative",
"selectableRelativeUnits": [
"minute",
"hour",
"day"
]
},
"id": "dateRange",
"title": "Date Range",
"type": "date",
"value": {
"relativeAmount": 7,
"relativeUnit": "day"
}
}Default Query Params
To make it easier for the BUILD developer, the date picker user selection is pre-processed to determine the start_date and end_date. These values are passed into the UDF (Python):
Parameter | Type | Description |
|---|---|---|
| string | The start date |
| string | The end date |
| string | The mode of the date picker. ( |
| string | The type of time selection. ( |
| string | The selected shortcut i.e. ( |
| string | The selected timezone i.e. |
| string | The time zone for production dates. |
| string | The current production day. |
In most simple cases the start_date and end_date should be sufficient to write the WHERE clause in the SQL query. i.e.
WHERE "Cycle End Time" >= :start_date AND "Cycle End Time" < :end_dateaTo handle more complex requirements like production days please see the Date Handling Guide for more help.
Page Link
Example mapping for setting specific dateRange on page link.
Making the selected range to a specific relative range.
{
"mapping": {
"dateRange": "{...dateRange, mode: 'relative', 'relativeAmount': 7, relativeUnit: 'day' }",
}
}Selecting a specific row and setting the date to absolute.
{
"mapping": {
"dateRange": "{mode: 'absolute', startDate: row['Cycle Start Time'], endDate: row['Cycle End Time'] }",
}
}