diff --git a/platform/commonUI/formats/bundle.json b/platform/commonUI/formats/bundle.json index 8f9b23d5f5..798bcc7369 100644 --- a/platform/commonUI/formats/bundle.json +++ b/platform/commonUI/formats/bundle.json @@ -15,6 +15,12 @@ "key": "utc", "implementation": "UTCTimeFormat.js" } + ], + "constants": [ + { + "key": "DEFAULT_TIME_FORMAT", + "value": "utc" + } ] } } diff --git a/platform/telemetry/bundle.json b/platform/telemetry/bundle.json index 79cf4d503a..bb21ccaa35 100644 --- a/platform/telemetry/bundle.json +++ b/platform/telemetry/bundle.json @@ -38,7 +38,7 @@ { "key": "telemetryFormatter", "implementation": "TelemetryFormatter.js", - "depends": [ "formatService" ] + "depends": [ "formatService", "DEFAULT_TIME_FORMAT", "$log" ] }, { "key": "telemetrySubscriber", diff --git a/platform/telemetry/src/TelemetryFormatter.js b/platform/telemetry/src/TelemetryFormatter.js index 125d92710c..1aa24b644d 100644 --- a/platform/telemetry/src/TelemetryFormatter.js +++ b/platform/telemetry/src/TelemetryFormatter.js @@ -37,8 +37,10 @@ define( * @memberof platform/telemetry * @constructor */ - function TelemetryFormatter(formatService) { + function TelemetryFormatter(formatService, defaultFormatKey, $log) { this.formatService = formatService; + this.defaultFormat = formatService.getFormat(defaultFormatKey); + this.$log = $log; } /** @@ -51,9 +53,11 @@ define( * data and time, suitable for display. */ TelemetryFormatter.prototype.formatDomainValue = function (v, key) { - var formatter = this.formatService.getFormat(key) || - this.formatService.getFormat('utc'); - return isNaN(v) ? "" : formatter.format(v); + var formatter = (key === undefined) ? + this.defaultFormat : + this.formatService.getFormat(key); + + return isNaN(v) ? "" : formatter ? formatter.format(v) : String(v); }; /**