That depends on the magnets. Two of most neodymium (rare-earth) magnets in either attractive or repulsive interaction should be able to hold their strength for very long periods of time, and the same would be true for two ceramic (ferrite) magnets. However, if one magnet is neodymium and the other is ceramic (usually much weaker than a neodymium magnet), in repulsive interaction the ferrite could lose significant strength if the two magnets are too close together.
Earlier magnets, like alnico magnets and especially steel magnets (which have not been in much use in recent years) can lose strength when in close repulsive interaction even with another of the same type, and especially if exposed in repulsive mode to a neodymium magnet or even a ceramic magnet.
making a small donation to science.ca.