Both are possible. There is a nuance in meaning however. 1 would imply that the realization came when they were at the very beginning of the twilight.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.