The Horizon Walker Ranger subclass gains Portal Lore ability (quoted from UA; I don't have Xanthar's Guide to compare the feature):
At 3rd level, you gain the ability to detect the presence of planar portals. As an action, you detect the distance and direction to any planar portals within 1,000 feet of you. You also sense which plane of existence each portal leads to. However, if magic obscures any details of a portal, this feature doesn’t reveal them.
On DMG page 45, it says that "most portals don't stand open all the time" and goes on to give some example conditions for a portal to become open.
Can the Portal Lore feature be used to detect an inactive portal, or do they fail to show up unless the Ranger happens to use the ability when the portal is open?
Obviously, a GM can make a ruling either way, but I'm looking for any information, including from other editions of D&D, that would inform a such a ruling.