In order to detect nightly work properly you can select the start time and duration of the nighly shift.

Open Settings click Client setting

Select Start time and duration of the night shift then click Save