Battery degradation is more related to charging habits than the duration of device connection. Avoid frequent short charges, it is better to charge your phone for longer periods rather than frequently plugging and unplugging it. Short charges can be more damaging to the battery.