How to treat outliers in a time series dataset?
Decide how auto-correlative your usual event in the time series is.
For example, "I'm tracking temperature over time and it rarely changes more
than 30 degrees F in an hour".
Throw out or smooth any values where the observed value changes
more than that. In other words, "If ever I see the temperature
changing more than 30 degrees in an hour, I'm going to ignore that value and substitute the average of the prior and the next value because that must be a sensor malfunction".


Once you were comfortable with doing that, use something like the standard deviation of the data over a rolling window instead of an absolute, arbitrary value like I did.