diff --git a/platform/features/imagery/src/controllers/ImageryController.js b/platform/features/imagery/src/controllers/ImageryController.js index 8bd8c36034..5439fc414c 100644 --- a/platform/features/imagery/src/controllers/ImageryController.js +++ b/platform/features/imagery/src/controllers/ImageryController.js @@ -59,6 +59,7 @@ define( releaseSubscription(); self.date = ""; self.time = ""; + self.zone = ""; self.imageUrl = ""; self.handle = domainObject && telemetryHandler.handle( domainObject, @@ -78,11 +79,16 @@ define( ImageryController.prototype.updateValues = function () { var imageObject = this.handle && this.handle.getTelemetryObjects()[0], + timestamp, m; if (imageObject && !this.isPaused) { - m = moment.utc(this.handle.getDomainValue(imageObject)); - this.date = m.format(DATE_FORMAT); - this.time = m.format(TIME_FORMAT); + timestamp = this.handle.getDomainValue(imageObject); + m = timestamp !== undefined ? + moment.utc(timestamp) : + undefined; + this.date = m ? m.format(DATE_FORMAT) : ""; + this.time = m ? m.format(TIME_FORMAT) : ""; + this.zone = m ? "UTC" : ""; this.imageUrl = this.handle.getRangeValue(imageObject); } }; @@ -112,7 +118,7 @@ define( * @returns {string} the time */ ImageryController.prototype.getZone = function () { - return "UTC"; + return this.zone; }; /** diff --git a/platform/features/imagery/test/controllers/ImageryControllerSpec.js b/platform/features/imagery/test/controllers/ImageryControllerSpec.js index 9bb00d6b20..6ae82b3d86 100644 --- a/platform/features/imagery/test/controllers/ImageryControllerSpec.js +++ b/platform/features/imagery/test/controllers/ImageryControllerSpec.js @@ -146,6 +146,19 @@ define( expect(controller.getImageUrl()).toEqual(testUrl); }); + it("initially shows an empty string for date/time", function () { + // Call the subscription listener while domain/range + // values are still undefined + mockHandle.getDomainValue.andReturn(undefined); + mockHandle.getRangeValue.andReturn(undefined); + mockTelemetryHandler.handle.mostRecentCall.args[1](); + + // Should have empty strings for date/time/zone + expect(controller.getTime()).toEqual(""); + expect(controller.getDate()).toEqual(""); + expect(controller.getZone()).toEqual(""); + expect(controller.getImageUrl()).toBeUndefined(); + }); }); } );