Skip to content

Commit

Permalink
adding bisect logic to get next date
Browse files Browse the repository at this point in the history
  • Loading branch information
eichblatt committed Oct 23, 2022
1 parent 2a3aa11 commit 58641a7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions timemachine/controls.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,9 +304,9 @@ def next_date(self):
if self.archive is None:
return None
self._update()
for d in self.archive.dates:
if d > self.fmtdate():
return datetime.datetime.fromisoformat(d).date()
current_index = bisect(self.archive.dates, self.fmtdate())
for d in self.archive.dates[current_index:] + self.archive.dates[:current_index]:
return datetime.datetime.fromisoformat(d).date()
return self.date


Expand Down

0 comments on commit 58641a7

Please sign in to comment.