Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

add a today route so we can always switch to today ...

Klaus Zanderse5ae50a5a175
diff --git a/modules/costs/app/components/my/time_tracking/sub_header_component.rb b/modules/costs/app/components/my/time_tracking/sub_header_component.rb
index aa37f01c2b1..006792336f6 100644
--- a/modules/costs/app/components/my/time_tracking/sub_header_component.rb
+++ b/modules/costs/app/components/my/time_tracking/sub_header_component.rb
@@ -54,7 +54,7 @@ module My
end
def today_href
- my_time_tracking_path(date: Date.current, view_mode:, mode:)
+ my_time_tracking_path(date: "today", view_mode:, mode:)
end
def previous_attrs # rubocop:disable Metrics/AbcSize
diff --git a/modules/costs/app/controllers/my/time_tracking_controller.rb b/modules/costs/app/controllers/my/time_tracking_controller.rb
index fb988f43e21..da455856fa3 100644
--- a/modules/costs/app/controllers/my/time_tracking_controller.rb
+++ b/modules/costs/app/controllers/my/time_tracking_controller.rb
@@ -81,10 +81,14 @@ module My
def parsed_date
if params[:date].present?
- begin
- Date.iso8601(params[:date])
- rescue StandardError
- nil
+ if params[:date] == "today"
+ current_date
+ else
+ begin
+ Date.iso8601(params[:date])
+ rescue StandardError
+ nil
+ end
end
end
end
diff --git a/modules/costs/config/routes.rb b/modules/costs/config/routes.rb
index 2a3ab497020..55bae7c66cc 100644
--- a/modules/costs/config/routes.rb
+++ b/modules/costs/config/routes.rb
@@ -55,7 +55,7 @@ Rails.application.routes.draw do
constraints: {
mode: /day|week|workweek|month/,
view_mode: /list|calendar/,
- date: /\d{4}-\d{2}-\d{2}/
+ date: /(\d{4}-\d{2}-\d{2}|today)/
}
get "/time-tracking/refresh" => "time_tracking#refresh",
as: :time_tracking_refresh