Skip to content

Self-hosted project management for devs and their clients: tickets, time tracking, docs and meetings, with an AI assistant that cites its sources. AGPL-3.0.

Write the knowledge list dates in the reader's language

Guido Boyke8dc3c8aec3a9
diff --git a/app/views/organisations/knowledge/_knowledge_row.html.erb b/app/views/organisations/knowledge/_knowledge_row.html.erb
index 9e8f774..bcf99f4 100644
--- a/app/views/organisations/knowledge/_knowledge_row.html.erb
+++ b/app/views/organisations/knowledge/_knowledge_row.html.erb
@@ -55,8 +55,8 @@
</td>
<td class="p-3 whitespace-nowrap w-[20%]" data-fb-col-date>
<div class="text-sm">
- <span class="date-full"><%= item.created_at.strftime("%d %b %Y %H:%M") %></span>
- <span class="date-compact hidden"><%= item.created_at.strftime("%d.%m.%y") %></span>
+ <span class="date-full"><%= l(item.created_at, format: :long) %></span>
+ <span class="date-compact hidden"><%= l(item.created_at.to_date) %></span>
</div>
</td>
<td class="p-3 w-[25%]">
diff --git a/spec/requests/organisations/knowledge_dates_spec.rb b/spec/requests/organisations/knowledge_dates_spec.rb
new file mode 100644
index 0000000..8676463
--- /dev/null
+++ b/spec/requests/organisations/knowledge_dates_spec.rb
@@ -0,0 +1,48 @@
+# frozen_string_literal: true
+
+require 'rails_helper'
+
+# The knowledge list writes its dates in the reader's language. Until 17.10.2026 the
+# row formatted them with strftime, which knows only English month names: the German
+# page said "14 Oct 2026", and the compact column wrote the German "14.10.26" on the
+# English page.
+RSpec.describe 'Knowledge list dates', type: :request do
+ let(:organisation) { create(:organisation) }
+ let(:project) { create(:project, organisation: organisation) }
+ let(:created_at) { Time.zone.local(2026, 10, 14, 10, 30) }
+
+ before do
+ ActsAsTenant.current_tenant = organisation
+ create(:note, project: project, organisation: organisation, creator: user, created_at: created_at)
+ create(:membership, user: user, organisation: organisation,
+ role: create(:admin_role, organisation: organisation), active: true)
+ sign_in user
+ end
+
+ def row_dates
+ page = Nokogiri::HTML(response.body)
+ [page.at_css('.date-full')&.text&.strip, page.at_css('.date-compact')&.text&.strip]
+ end
+
+ context 'with a German reader' do
+ let(:user) { create(:user, language_preference: 'de') }
+
+ it 'names the month in German' do
+ get organisation_project_knowledge_index_path(organisation, project)
+
+ expect(response).to have_http_status(:ok)
+ expect(row_dates).to eq(['14. Oktober 2026, 10:30', '14.10.2026'])
+ end
+ end
+
+ context 'with an English reader' do
+ let(:user) { create(:user, language_preference: 'en') }
+
+ it 'names the month in English' do
+ get organisation_project_knowledge_index_path(organisation, project)
+
+ expect(response).to have_http_status(:ok)
+ expect(row_dates).to eq(['October 14, 2026 10:30', '2026-10-14'])
+ end
+ end
+end