Default date in datepicker

Hey guys need some help making my datepicker have a default value.
i have tried the following : {{moment().format("MMM DD,YYYY")}} but the picker does not populate.
i also tried date.now() it does populate but does not load the data unless i press the picker and reselect enddate
any help

Hello, There seem no problem with cloud version.

Which version Retool you used? self-hosted? and version?

it populates the dates yes but , it does not make the table show the filtered data unless i click the end date calendar pop up . the date filter is used in an sql statement

Sorry, I don't understand what is your meaning about above.
It seem it work as expected

Can you share your query if its possible?

SELECT Position,title as'Headline',url,firstpopular,lastpopular FROM NEWS WHERE  (firstpopular >= CONVERT({{datepicker.value.start == "" ? '1001-01-01' : datepicker.value.start}}, datetime))AND
(firstpopular < CONVERT({{datepicker.value.end == "" ? '9999-12-31' : moment(datepicker.value.end).add(1, 'days')}}, datetime))  ORDER BY Position ASC

Just try this simple way.

In your case, try this one

SELECT
  Position,
  title as 'Headline',
  url,
  firstpopular,
  lastpopular

FROM NEWS

WHERE firstpopular BETWEEN
  {{ datepicker.value.start || '1900-9-9' }}
  AND {{ datepicker.value.end || '9999-9-9' }}

ORDER BY Position ASC
1 Like

what did you put as your default start date? {{moment().format("MMM DD,YYYY")}}?

Just put {{ moment() }} you dont need to format it.
Or any date you want {{ moment('2023-05-01') }}

1 Like