Date field is malformatted if it returns in IF() function. It works properly with CASE:
Please find the ax_bug_date_display_error_when_IF_used.sql to reproduce
Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.