Add 'Last Month' date range for timesheet reports

This commit is contained in:
Miguel Jacq 2025-12-23 16:00:57 +11:00
parent 426142c0c3
commit df6ea8d139
Signed by: mig5
GPG key ID: 59B3F0C24135C6A9
4 changed files with 10 additions and 0 deletions

View file

@ -5,6 +5,7 @@
* Allow setting a code block on a line that already has text (it will start a newline for the codeblock) * 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 * 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 missing strings (for English and French)
* Add 'Last Month' date range for timesheet reports
# 0.7.5 # 0.7.5

View file

@ -217,6 +217,7 @@
"date_range": "Date range", "date_range": "Date range",
"custom_range": "Custom", "custom_range": "Custom",
"last_week": "Last week", "last_week": "Last week",
"last_month": "Last month",
"this_week": "This week", "this_week": "This week",
"this_month": "This month", "this_month": "This month",
"this_year": "This year", "this_year": "This year",

View file

@ -217,6 +217,7 @@
"date_range": "Plage de dates", "date_range": "Plage de dates",
"custom_range": "Personnalisé", "custom_range": "Personnalisé",
"last_week": "La semaine dernière", "last_week": "La semaine dernière",
"last_month": "Le mois dernier",
"this_week": "Cette semaine", "this_week": "Cette semaine",
"this_month": "Ce mois-ci", "this_month": "Ce mois-ci",
"this_year": "Cette année", "this_year": "Cette année",

View file

@ -1055,6 +1055,7 @@ class TimeReportDialog(QDialog):
self.range_preset.addItem(strings._("today"), "today") self.range_preset.addItem(strings._("today"), "today")
self.range_preset.addItem(strings._("last_week"), "last_week") self.range_preset.addItem(strings._("last_week"), "last_week")
self.range_preset.addItem(strings._("this_week"), "this_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_month"), "this_month")
self.range_preset.addItem(strings._("this_year"), "this_year") self.range_preset.addItem(strings._("this_year"), "this_year")
self.range_preset.currentIndexChanged.connect(self._on_range_preset_changed) 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 start = start_of_this_week.addDays(-7) # last week's Monday
end = start_of_this_week.addDays(-1) # last week's Sunday 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": elif preset == "this_month":
start = QDate(today.year(), today.month(), 1) start = QDate(today.year(), today.month(), 1)
end = today end = today