please have a look at the attached picture.. Neither "ORDER BY" nor "TO_CHART" functions are working properly on DATE type.
pgsql-bugs by date:
Соглашаюсь с условиями обработки персональных данных