Another very common way to reduce date precision is to group dates according to a period of time from an initial date.
For example, if we have the date of birth of a person, we may want to output what range of years the age of this person belongs to.
e.g. 1/1/1990 -> 1990 or 20-30 years
Possible config:
{
"actions": [
{
"name": "timeElapsed",
"dateConfig": {
"format": "YYYYmmmdd",
// should we count the number of months or years
"elapsedIn": "years",
// since when should we count
// accepts a date in the above format or `now` as a value
"since": "19901212"
},
"rangeConfig": {
"ranges": [
{
"gt": 20,
"lte": 30,
"output": "20-30 years"
}
]
}
}
]
}
Another very common way to reduce date precision is to group dates according to a period of time from an initial date.
For example, if we have the date of birth of a person, we may want to output what range of years the age of this person belongs to.
e.g. 1/1/1990 -> 1990 or 20-30 years
Possible config: