Date Parameters in Safari

I have a visualization where I’m building a link to another report. When the dashboard loads, the link looks something like:

/dashboard/test-dashboard?p_Client=38&p_StartDate=2019-5-1&p_EndDate=2019-5-31

What I’ve found is that the link works in Chrome, but if I do the same thing in safari I get an error that says “Error running query: missing values for StartDate, EndDate parameters.” After playing around a bit, I noticed that if I change the date format in the query string to be YYYY-MM-DD it works. So this would be the corrected link.

/dashboard/test-dashboard?p_Client=38&p_StartDate=2019-05-01&p_EndDate=2019-05-31

Is there anyway for me to address that in my url template? This is what I currently have for a template:

/dashboard/test-dashboard?p_Client={{@}}&p_StartDate={{StartDate}}&p_EndDate={{EndDate}}

I don’t really understand why it works for Chrome but not Safari… Running Version: 7.0.0+b17535 (15c815fb)

Thanks,
Craig

What version of Redash are you using?

Just noticed that you did mention the version you’re using :flushed:

The StartDate values in the URL template – they come from a DB column?

So your question rang a bell with me. Basically, what I did was I added the parameters as hidden columns to the table visualization with the following:

, StartDate = cast(datepart(yyyy, ‘{{StartDate}}’) as varchar(4)) + ‘-’ + cast(datepart(MM, ‘{{StartDate}}’) as varchar(2)) + ‘-’ + cast(datepart(dd, ‘{{StartDate}}’) as varchar(2))
, EndDate = cast(cast(datepart(yyyy, ‘{{EndDate}}’) as varchar(4)) + ‘-’ + cast(datepart(MM, ‘{{EndDate}}’) as varchar(2)) + ‘-’ + cast(datepart(dd, ‘{{EndDate}}’) as varchar(2))

That was the culprit for stripping out the leading zeros.

What I did now was I switched the above:

, StartDate = ‘{{StartDate}}’
, EndDate = ‘{{EndDate}}’

And I formatted those with ‘YYYY-MM-DD’ in the table. The issue now is that the URL that is being built for the link includes the full datetime instead of the formatted dates. Any suggestions to get around that?

/dashboard/test-dashboard?p_Client=81&p_StartDate=Wed%20May%2001%202019%2000:00:00%20GMT+0000&p_EndDate=Fri%20May%2031%202019%2000:00:00%20GMT+0000

So I got it to work with a hack… I formatted my dates and concatenated with dummy parameters. That kept the column from getting automatically converted to datetime. I’m hiding these columns so no one can see them. The link get’s built correctly with the extra parameters but they just get ignored by my second dashboard.

    , StartDate = CONVERT(VARCHAR(10),'{{StartDate}}', 120) +'&p_ignore1=1'
    , EndDate = CONVERT(VARCHAR(10),'{{EndDate}}', 120) +'&p_ignore2=1'