The following is one of the model sentences I have found in a writing/composition textbook now in use for high school students.
Just before going to sleep is the time when I enjoy reading the most.
I am wondering if it is grammatically correct to take a prepositional phrase like “just before going to sleep” as the subject of a sentence. When I was a student, I was taught from teachers of English that the subject of a sentence should be a noun equivalent.