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

[#64337] The time in the pdf export is different from the time in the file name

as-opce9207f4036f
diff --git a/app/models/work_package/pdf_export/common/common.rb b/app/models/work_package/pdf_export/common/common.rb
index 0afd576868c..297cffad88c 100644
--- a/app/models/work_package/pdf_export/common/common.rb
+++ b/app/models/work_package/pdf_export/common/common.rb
@@ -268,12 +268,16 @@ module WorkPackage::PDFExport::Common::Common
"#{truncate(sane_filename(base), length: 255 - suffix.length, escape: false)}#{suffix}".tr(" ", "-")
end
+ def export_datetime
+ @export_datetime ||= Time.zone.now
+ end
+
def title_datetime
- DateTime.now.strftime("%Y-%m-%d_%H-%M")
+ export_datetime.strftime("%Y-%m-%d_%H-%M")
end
def footer_date
- format_time(Time.zone.now)
+ format_time(export_datetime)
end
def current_page_nr