Fix date sorting in charts.js