If the Phantom Steed spell ends because the steed takes damage, do you still have 1 minute to dismount?

The spell states:

When the spell ends, the steed gradually fades, giving the rider 1 minute to dismount. The spell ends if you use an action to dismiss it or if the steed takes any damage.

So, if the steed takes damage, does it still last for 1 minute, or does the spell end automatically if it takes damage?