Modified and renamed function to trim time series to common period