This idea was originally suggested four years ago. It received over 1,000 kudos and appears to be stuck in the "ideas for conversation" area. I think it is time it moved to a review stage by the developers. The only idea I would add to this is an option to automatically unpublish as well. For example, a module or page is published/viewable for only a week. Educators can set and forget it. Additionally, they can plan for at least a week out and have materials available at the correct times. Below you will find the original request made by @aungaro in 2016:
It would be nice to be able to schedule those times in advance. There are times I don't want to publish something for students to see until after class and that requires remembering to go back and publish. Forgetting to do so only then creates chaos. It'd be nice to just set those times once the page is designed and avoid those circumstances.