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 iso8601 duration formatter for days and hours

Oliver Günther7344994a4cd6
diff --git a/frontend/src/app/core/datetime/timezone.service.ts b/frontend/src/app/core/datetime/timezone.service.ts
index 7e87bd0a0fa..a192500a2db 100644
--- a/frontend/src/app/core/datetime/timezone.service.ts
+++ b/frontend/src/app/core/datetime/timezone.service.ts
@@ -149,6 +149,10 @@ export class TimezoneService {
return Number(moment.duration(durationString).asDays().toFixed(2));
}
+ public toISODuration(input:string|number, unit:'hours'|'days'):string {
+ return moment.duration(input, unit).toIsoString();
+ }
+
public formattedDuration(durationString:string, unit:'hour'|'days' = 'hour'):string {
switch (unit) {
case 'hour':