It was occupied by Germany since 1940, which was a long time before the war ended. I knew something was wrong with your statement when I read it because I recall the big flap about the Danish king saying something like "We'll all have to wear yellow stars." (disputed, by the way.)
https://en.natmus.dk/historical-knowledge/denmark/german-occupation-1940-1945/
See my reply 36.