diff --git a/CHANGELOG.md b/CHANGELOG.md index 68ea976..31e7a3d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ * Allow setting a code block on a line that already has text (it will start a newline for the codeblock) * Retain indentation when tab is used to indent a line, unless enter is pressed twice or user deletes the indentation * Add missing strings (for English and French) + * Add 'Last Month' date range for timesheet reports # 0.7.5 diff --git a/bouquin/locales/en.json b/bouquin/locales/en.json index 8c3fa54..c8784fd 100644 --- a/bouquin/locales/en.json +++ b/bouquin/locales/en.json @@ -217,6 +217,7 @@ "date_range": "Date range", "custom_range": "Custom", "last_week": "Last week", + "last_month": "Last month", "this_week": "This week", "this_month": "This month", "this_year": "This year", diff --git a/bouquin/locales/fr.json b/bouquin/locales/fr.json index 4d304df..2b889d7 100644 --- a/bouquin/locales/fr.json +++ b/bouquin/locales/fr.json @@ -217,6 +217,7 @@ "date_range": "Plage de dates", "custom_range": "Personnalisé", "last_week": "La semaine dernière", + "last_month": "Le mois dernier", "this_week": "Cette semaine", "this_month": "Ce mois-ci", "this_year": "Cette année", diff --git a/bouquin/time_log.py b/bouquin/time_log.py index b93e286..1e4b303 100644 --- a/bouquin/time_log.py +++ b/bouquin/time_log.py @@ -1055,6 +1055,7 @@ class TimeReportDialog(QDialog): self.range_preset.addItem(strings._("today"), "today") self.range_preset.addItem(strings._("last_week"), "last_week") self.range_preset.addItem(strings._("this_week"), "this_week") + self.range_preset.addItem(strings._("last_month"), "last_month") self.range_preset.addItem(strings._("this_month"), "this_month") self.range_preset.addItem(strings._("this_year"), "this_year") self.range_preset.currentIndexChanged.connect(self._on_range_preset_changed) @@ -1214,6 +1215,12 @@ class TimeReportDialog(QDialog): start = start_of_this_week.addDays(-7) # last week's Monday end = start_of_this_week.addDays(-1) # last week's Sunday + elif preset == "last_month": + # Previous calendar month (full month) + start_of_this_month = QDate(today.year(), today.month(), 1) + start = start_of_this_month.addMonths(-1) + end = start_of_this_month.addDays(-1) + elif preset == "this_month": start = QDate(today.year(), today.month(), 1) end = today