Probably years, if not more. XKCD's "What If?" has a nice explanation on a similar question, but in that case it was a portal at the bottom of the mariana trench and the question was about draining the oceans. The answer is that you probably wouldn't notice in all your lifetime.
I remember that video, but I‘m not sure it is comparable — air might flow faster than water [citation needed] and there might be less of it [citation needed].
Unless the pressure differential causes it to escape the moons gravity well it would probably stabilize at some point before dumping the whole atmosphere, right?
Pretty sure the game theorists channel on youtube did that one several years back. It's been a minute since I watched it but a search should pull it for you.
This one? https://youtu.be/0Hwjmek0Uvw
It more addresses survivability in space, but unfortunately not the „drain earth of its atmosphere“ thing. Then again, in game the portal was closed quickly again.
Easy solution for that, you fire the earth portal on a wall inside some sort of specially constructed airlock.
That hard part would be getting the moon portal in a useful place, you'd probably need to go up there and find a good solid cliff face or something. On the plus side having done that you could be home again in a few seconds.