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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
set locale for calendar from the outside
Klaus Zanders80fdfaccdd66
diff --git a/frontend/src/stimulus/controllers/dynamic/my/time-tracking.controller.ts b/frontend/src/stimulus/controllers/dynamic/my/time-tracking.controller.tsindex e35bb3cda22..6c5632c0c94 100644--- a/frontend/src/stimulus/controllers/dynamic/my/time-tracking.controller.ts+++ b/frontend/src/stimulus/controllers/dynamic/my/time-tracking.controller.ts@@ -6,6 +6,7 @@ import interactionPlugin from '@fullcalendar/interaction';import { TurboRequestsService } from 'core-app/core/turbo/turbo-requests.service';import { PathHelperService } from 'core-app/core/path-helper/path-helper.service';import moment from 'moment';+import allLocales from '@fullcalendar/core/locales-all';import { renderStreamMessage } from '@hotwired/turbo';export default class MyTimeTrackingController extends Controller {@@ -19,6 +20,7 @@ export default class MyTimeTrackingController extends Controller {timeEntries: Array,initialDate: String,canCreate: Boolean,+ locale: String,canEdit: Boolean,forceTimes: Boolean,};@@ -30,6 +32,7 @@ export default class MyTimeTrackingController extends Controller {declare readonly canCreateValue:boolean;declare readonly canEditValue:boolean;declare readonly forceTimesValue:boolean;+ declare readonly localeValue:string;private calendar:Calendar;@@ -46,8 +49,8 @@ export default class MyTimeTrackingController extends Controller {this.calendar = new Calendar(this.calendarTarget, {plugins: [timeGridPlugin, dayGridPlugin, interactionPlugin],initialView: this.calendarView(),- firstDay: 1, // get from settings- locale: 'de', // also get from settings+ locales: allLocales,+ locale: this.localeValue,events: this.timeEntriesValue,headerToolbar: false,initialDate: this.initialDateValue,@@ -71,7 +74,7 @@ export default class MyTimeTrackingController extends Controller {let timeDetails = '';if (!arg.event.allDay) {- timeDetails = `<div class="color-fg-muted mt-3">${moment(arg.event.start).format('HH:mm')} - ${moment(arg.event.end).format('HH:mm')}</div>`;+ timeDetails = `<div class="color-fg-muted mt-3">${moment(arg.event.start).format('LT')} - ${moment(arg.event.end).format('LT')}</div>`;}return {diff --git a/modules/costs/app/components/my/time_tracking/calendar_component.rb b/modules/costs/app/components/my/time_tracking/calendar_component.rbindex d24e5643612..c6c39eccc7a 100644--- a/modules/costs/app/components/my/time_tracking/calendar_component.rb+++ b/modules/costs/app/components/my/time_tracking/calendar_component.rb@@ -49,7 +49,8 @@ module My"my--time-tracking-initial-date-value" => date.iso8601,"my--time-tracking-can-create-value" => User.current.allowed_in_any_project?(:log_own_time),"my--time-tracking-can-edit-value" => User.current.allowed_in_any_project?(:edit_own_time_entries),- "my--time-tracking-force-times-value" => TimeEntry.must_track_start_and_end_time?+ "my--time-tracking-force-times-value" => TimeEntry.must_track_start_and_end_time?,+ "my--time-tracking-locale-value" => I18n.locale}end