Hard water will eventually ruin a dishwasher overtime and shorten the lifespan of the dishwasher.
The hard water can lead to calcium buildup in the plumbing and small screens of the dishwasher water inlet and then could cause the dishwasher to fail to clean or drain properly.
If you have hard water in your home you should get a water softener to keep the water softened so that it doesn't ruin your dishwasher or washing machine or any other water appliance.
The hard water can take 3 to 5 years off a dishwasher or washing machines lifespan so by having the water softener it will save you money on having to replace those appliances.
I used to go through a dishwasher every 3 years with hard water but after installing the water softener the dishwasher lasted 10 years.