Curve editor limits

Select an option from the Curve Editor tab > Edit panel > Limits menu to control how to limit or extend curves: