Datepicker
Rework pending, no delivery date. The Front App SDK (ReactJS) and the Front API SDK (NodeJS) are both being replaced. This page documents the current release, remains accurate, and is maintained until the replacement ships. Code written against it keeps working.
The Datepicker allows you to select a date range to filter the data in a chart.
Configuration
Here is a configuration example followed by further explanations.
Dates are defined with the momentjs library (see below for more information).
Configuring minimum and maximum dates available
The following rules explains how to control the datepicker edges :
- in case a
requestis provideddatepickerwill look for the first field in the query, looking forminandmaxcompute mode- if only
maxis given,mintakes same value asmax
- if
requestis not set :maxis set tonow()minis set to now()
maxDate,startAt,endAtare defined relative tomaxminDateis defined relative tomin- if
minDateis not provided, it will be the beginning of previous year relative tomax - in all case, you may specifiy a precise date by
set({'year': 2020, 'month': 0, 'date': 1})
To wrap it up, to define selectable dates :
- by default it goes :
- from beginning of previous year
- until today
- you may define them using
minDateandmaxDateproperties relative from today - you may define a
requestto selectminand/ormaxdate
When getting a min from request, minDate is relative to min and not anymore from max
Adding it in another React component
Example:
moment.js Library
The datepicker uses the library momentjs. This allows you to easily select a desired period. In code you can directly supply an object in momentjs format for each parameter. However, in JSON format, momentjs is used through a "string" format.
For instance:
becomes

