Expand description
Port of Redash’s client-side dynamic-date resolution.
Redash resolves no d_* tokens server-side: its frontend expands them in
getExecutionValue() before sending, so the server (and both the local
ad-hoc and --remote stored-query API paths) only ever sees concrete
dates. The stored-query endpoint outright rejects raw d_* values. We must
therefore resolve tokens here, ahead of either path.
The token set and semantics mirror upstream Redash (verified against commit
d32d5ae4):
- single
date/datetime*:client/app/services/parameters/DateParameter.js(DYNAMIC_DATES— onlynowandyesterday) *-range:client/app/services/parameters/DateRangeParameter.js(DYNAMIC_DATE_RANGES)
Matching details worth preserving on a Redash upgrade: last_* ranges end
at the current instant (moment’s untilNow), not end-of-day; the week
starts Sunday (moment.js default startOf("week")); formats come from
upstream DATETIME_FORMATS.