How are you testing your rule? Are you arming the system in Stay mode before sunset, and then expecting the door to close when sunset occurs? If so, your rule won't work because the WHENEVER clause is triggered only once - at the moment that the system changes to Armed - Stay mode. If it is later than sunset at that moment, the door should close. But if it is earlier than sunset it will not, even when sunset arrives.
Also, note that LATER THAN SUNSET will only work up until midnight. After midnight, it is no longer later than sunset. You then need to have another rule that tests for EARLIER THAN SUNRISE. Or, use AND IT IS DARK OUTSIDE.
This explanation of
why some rules don't work might help you understand things better.
You need to think about the different cases that you might encounter, such as
- when the system is armed before sunset
- when the system is armed after sunset
- what should happen if the system is armed after sunset and someone opens the door.
You'll need rules to cover each case.