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
Add helper to get the user's current time zone, guessing
Oliver Güntherb589e4c46bb0
diff --git a/frontend/src/app/core/datetime/timezone.service.ts b/frontend/src/app/core/datetime/timezone.service.tsindex cdef0e15a06..43879ce52d1 100644--- a/frontend/src/app/core/datetime/timezone.service.ts+++ b/frontend/src/app/core/datetime/timezone.service.ts@@ -47,19 +47,21 @@ export class TimezoneService {moment.locale(I18n.locale);}+ /**+ * Returns the user's configured timezone or guesses it through moment+ */+ public userTimezone():string {+ return this.configurationService.isTimezoneSet() ? this.configurationService.timezone() : moment.tz.guess();+ }+/*** Takes a utc date time string and turns it into* a local date time moment object.*/public parseDatetime(datetime:string, format?:string):Moment {- const d = moment.utc(datetime, format);-- if (this.configurationService.isTimezoneSet()) {- d.local();- d.tz(this.configurationService.timezone());- }-- return d;+ return moment+ .utc(datetime, format)+ .tz(this.userTimezone());}public parseDate(date:Date|string, format?:string):Moment {