follow-up - reverted getDateQuery logic

This commit is contained in:
Maxime-J 2022-07-22 12:35:37 +00:00
parent 15ae4569c5
commit bb1d17a5e2

View File

@ -21,7 +21,7 @@ export function getDateQuery(field, unit, timezone) {
if (timezone) {
return `to_char(date_trunc('${unit}', ${field} at time zone '${timezone}'), '${POSTGRESQL_DATE_FORMATS[unit]}')`;
}
return `date_trunc('${unit}', ${field})`;
return `to_char(date_trunc('${unit}', ${field}), '${POSTGRESQL_DATE_FORMATS[unit]}')`;
}
if (db === MYSQL) {
@ -31,7 +31,7 @@ export function getDateQuery(field, unit, timezone) {
return `date_format(convert_tz(${field},'+00:00','${tz}'), '${MYSQL_DATE_FORMATS[unit]}')`;
}
return `${field}`;
return `date_format(${field}, '${MYSQL_DATE_FORMATS[unit]}')`;
}
}