fix bug in date sorting for timeseries