Holidays will not be detracted.
Read all of the official information here:
https://www.nyidanmark.dk/en-GB/Words-a ... 7B2CFA9788
"When calculating the 8 years, in some cases 4 years, of legal residence in Denmark the periods in which you have resided abroad will be subtracted unless it is a short stay abroad e.g. a holiday."
You are not 'residing' in a country, unless you either are or should be registered in their equivalent of 'folkeregisteret'.
Even if you have been residing in another country it is not necessarily to be subtracted: "In some cases, periods of time spent abroad can count as legal residence in Denmark.
This applies e.g. if you in the course of the employment have been stationed or deployed abroad for a period. That is if you are employed in a Danish company but you are deployed to solve a task or work abroad.
The period abroad is only included if you are stationed or deployed for:
a Danish public authority,
a private company,
a non-government organisation, or
a foreign or Danish aid agency"
The same goes if it was not you, but your spouse/partner, who had that kind of deployment.