diff --git a/platform/commonUI/formats/src/UTCTimeFormat.js b/platform/commonUI/formats/src/UTCTimeFormat.js index 3faab7a620e..5d1fba01171 100644 --- a/platform/commonUI/formats/src/UTCTimeFormat.js +++ b/platform/commonUI/formats/src/UTCTimeFormat.js @@ -95,6 +95,38 @@ define([ })[0][0]; } + UTCTimeFormat.prototype.timeUnits = function (timeRange) { + var momentified = moment.duration(timeRange); + return [ + ["Decades", function (r) { + return r.years() > 15; + }], + ["Years", function (r) { + return r.years() > 0; + }], + ["Months", function (r) { + return r.months() > 0; + }], + ["Days", function (r) { + return r.days() > 0; + }], + ["Hours", function (r) { + return r.hours() > 0; + }], + ["Minutes", function (r) { + return r.minutes() > 0; + }], + ["Seconds", function (r) { + return r.seconds() > 0; + }], + ["Milliseconds", function (r) { + return true; + }] + ].filter(function (row){ + return row[1](momentified); + })[0][0]; + }; + /** * * @param value diff --git a/platform/features/conductor-v2/conductor/bundle.js b/platform/features/conductor-v2/conductor/bundle.js index 7c49ccd7c43..122e2a69ac5 100644 --- a/platform/features/conductor-v2/conductor/bundle.js +++ b/platform/features/conductor-v2/conductor/bundle.js @@ -69,7 +69,8 @@ define([ "$window", "timeConductor", "timeConductorViewService", - "timeSystems[]" + "timeSystems[]", + "formatService" ] }, { diff --git a/platform/features/conductor-v2/conductor/res/templates/time-conductor.html b/platform/features/conductor-v2/conductor/res/templates/time-conductor.html index 37ad80b8ffa..2826bc86a0f 100644 --- a/platform/features/conductor-v2/conductor/res/templates/time-conductor.html +++ b/platform/features/conductor-v2/conductor/res/templates/time-conductor.html @@ -115,7 +115,8 @@
- + {{timeUnits}}