I'd be a bit careful with this notion in the middle of an adventure, however. You probably don't want the PCs twiddling their thumbs for a month or two waiting for the moons to be right before they can continue on their quest. That sort of thing just begs the players to get distracted doing something else, while your poor adventure languishes, abandoned. But it's great for megadungeons where you want to save some areas that can only be touched at specific times, offering an inducement for the PCs to return. As Odyssey says:
This would work best with large dungeons, or if you otherwise had a reason to return to it over time. Then the dungeon would cycle through different areas being open; the players might even need to complete some task or puzzle in one area to get further into another.
You could also have a door that's open at all times, but where it takes you depends on something like the phases of the moon. The more full the moon is, the deeper the level you enter when passing through the door. Only when entering when the moon is new can you find the lich's hidden pocket-dimension, and actually face your arch-nemesis.