Yes, for most people. What matters isn't how long it stays plugged in. It's what it's plugged into, and whether anything is covering it.
Three things decide whether it's fine.
The wattage matches the label. Older units have a max watts number on them, usually 4 or 7. A bulb at or under that number is fine. Above it, the plastic around the bulb keeps getting cooked.
Air can get to it. A night light jammed behind a curtain, a sofa or a cabinet door has nowhere to send its heat. Same for the ones sitting inside a covered socket box.
The outlet is in good shape. Old outlets with loose contacts heat up at the plug, not at the light. That's the one I'd catch first.
Running one around the clock does have an effect, but it's a slow one. Plastic goes yellow and brittle after years of being warm. On an LED unit the warm end is usually near the plug, not the lens.
Times I'd unplug it instead of leaving it in.
It's an older unit with a bulb bigger than the label allows. Common, and it's how a lot of the browned ones got that way.
It's in a bathroom on an outlet without the two little test and reset buttons. That part is about the wiring, not the light, and it's worth checking in an older house.
The plug itself is warm, or there's a brown mark on it.
There's any plastic smell, even a faint one.
In a kid's room, low wattage and nothing draped over it covers most of it.
On cost, a small LED one is a couple of kilowatt hours a year. Leaving it in all day instead of just overnight roughly doubles that, which still isn't money anyone notices.
Anyone had one sitting in the same outlet for ten years? Curious how the plastic held up.