diff --git a/examples/working_hours_gspread.py b/examples/working_hours_gspread.py index 689913d..3270c84 100644 --- a/examples/working_hours_gspread.py +++ b/examples/working_hours_gspread.py @@ -17,6 +17,7 @@ Usage: python3 working_hours_gspread.py """ + import socket import sys from datetime import datetime, time, timedelta @@ -92,6 +93,10 @@ def update_sheet(sheet_key: str, regex: str): # Iterate over the result and update or append the data to the Google Sheet for tp, r in zip(timeperiods, res): + # skip if the timeperiod is in the future (might happen between midnight and the day_offset) + if tp[0] > now: + continue + date = tp[0].date() duration = ( working_hours.generous_approx(r["events"], break_time).total_seconds()