Both are acceptable. It doesn't matter in spoken language because they sound the same. My perception (although this may be incorrect) is that i dag is more formal and a bit more archaic, while idag is less formal and more modern. I suggest that you choose one and stick to it.
The odd thing is that I was taught "idag", igår" och "imorgon" in school, but the recommended forms have changed (I don't know when). I think it makes sense though if you compare to "i förrgår" (the day before yesterday), "i eftermiddag" (this afternoon) or "i sommar" (this summer) etc which are split.
That's very interesting! I wonder why "they" (whoever "they" are) decided to change the recommended forms... :)
What is the moderators opinion on this? Writing it together does mark the work as semi incorrect every time. (You get the green bar, but still.)
We write it that way because the language council recommends it. We don't put both as 'best' translation, because then they would both show up everywhere in multiple choice questions and you'd have to tick both all the time and that would quickly get boring.
I get accused of having a typo even though my answer is identical to doulingo
As noted above, i dag and idag are both fine spellings. But Duolingo apparently first compares what you wrote to the default translation and then never bothers to check alternate translations. I get the same typo alert, which is obviously incorrect. But I'm afraid I can't fix it without making both spelling variations into defaults.