Skip to content

Commit

Permalink
change default day only if date is set
Browse files Browse the repository at this point in the history
  • Loading branch information
ederag committed Apr 22, 2020
1 parent 592bbc7 commit fadaf45
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/hamster/edit_activity.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,9 @@ def on_start_date_changed(self, widget):
# preserve fact duration
self.fact.end_time += delta
self.end_date.date = self.fact.end_time
self.day = self.fact.date or dt.hday.today()
if self.fact.date:
# change default day only if date is set
self.day = self.fact.date
self.validate_fields()
self.update_cmdline()

Expand All @@ -268,7 +270,7 @@ def on_start_time_changed(self, widget):
new_time)
else:
# date not specified; result must fall in current hamster_day
new_start_time = dt.datetime.from_day_time(dt.hday.today(), new_time)
new_start_time = dt.datetime.from_day_time(self.day, new_time)
else:
new_start_time = None
self.fact.start_time = new_start_time
Expand Down

0 comments on commit fadaf45

Please sign in to comment.