Format updates when time system selected

This commit is contained in:
Henry 2016-08-01 17:11:01 -07:00
parent ce5d0ef5bd
commit a75ea67b8c
5 changed files with 13 additions and 12 deletions

View File

@ -33,7 +33,7 @@ define([
"extensions": { "extensions": {
"formats": [ "formats": [
{ {
"key": "local", "key": "local-format",
"implementation": LocalTimeFormat "implementation": LocalTimeFormat
} }
], ],

View File

@ -26,11 +26,11 @@ define([
moment moment
) { ) {
var DATE_FORMAT = "YYYY-MM-DD hh:mm:ss.SSS", var DATE_FORMAT = "YYYY-MM-DD h:mm:ss.SSS a",
DATE_FORMATS = [ DATE_FORMATS = [
DATE_FORMAT, DATE_FORMAT,
"YYYY-MM-DD hh:mm:ss", "YYYY-MM-DD h:mm:ss a",
"YYYY-MM-DD hh:mm", "YYYY-MM-DD h:mm a",
"YYYY-MM-DD" "YYYY-MM-DD"
]; ];
@ -67,8 +67,8 @@ define([
return [ return [
[".SSS", function(m) { return m.milliseconds(); }], [".SSS", function(m) { return m.milliseconds(); }],
[":ss", function(m) { return m.seconds(); }], [":ss", function(m) { return m.seconds(); }],
["hh:mm", function(m) { return m.minutes(); }], ["hh:mma", function(m) { return m.minutes(); }],
["hh", function(m) { return m.hours(); }], ["hha", function(m) { return m.hours(); }],
["ddd DD", function(m) { ["ddd DD", function(m) {
return m.days() && return m.days() &&
m.date() != 1; m.date() != 1;

View File

@ -42,11 +42,11 @@ define([
*/ */
this.metadata = { this.metadata = {
'key': 'local', 'key': 'local',
'name': 'Local 12 hour', 'name': 'Local',
'glyph': '\u0043' 'glyph': '\u0043'
}; };
this._formats = ['utc']; this._formats = ['local-format'];
this._tickSources = [new LocalClock($timeout, DEFAULT_PERIOD)]; this._tickSources = [new LocalClock($timeout, DEFAULT_PERIOD)];
} }

View File

@ -105,8 +105,6 @@ define([
'./platform/search/bundle', './platform/search/bundle',
'./platform/status/bundle', './platform/status/bundle',
'./platform/commonUI/regions/bundle' './platform/commonUI/regions/bundle'
//'./examples/localTimeSystem/bundle'
//'./example/msl/bundle'
], function (Main, legacyRegistry) { ], function (Main, legacyRegistry) {
return { return {
legacyRegistry: legacyRegistry, legacyRegistry: legacyRegistry,

View File

@ -212,10 +212,12 @@ define(
this.$scope.timeSystemModel.options = this.selectedMode.timeSystems().map(function (timeSystem) { this.$scope.timeSystemModel.options = this.selectedMode.timeSystems().map(function (timeSystem) {
return timeSystem.metadata; return timeSystem.metadata;
}); });
this.$scope.timeSystemModel.selected = timeSystem;
this.setTimeSystem(timeSystem);
/*this.$scope.timeSystemModel.selected = timeSystem;
//Use default format //Use default format
this.$scope.timeSystemModel.format = timeSystem.formats()[0]; this.$scope.timeSystemModel.format = timeSystem.formats()[0];
this.setDeltasFromTimeSystem(timeSystem); this.setDeltasFromTimeSystem(timeSystem); */
} }
}; };
@ -260,6 +262,7 @@ define(
TimeConductorController.prototype.setTimeSystem = function (newTimeSystem) { TimeConductorController.prototype.setTimeSystem = function (newTimeSystem) {
if (newTimeSystem && newTimeSystem !== this.$scope.timeSystemModel.selected) { if (newTimeSystem && newTimeSystem !== this.$scope.timeSystemModel.selected) {
this.$scope.timeSystemModel.selected = newTimeSystem; this.$scope.timeSystemModel.selected = newTimeSystem;
this.$scope.timeSystemModel.format = newTimeSystem.formats()[0];
var mode = this.selectedMode; var mode = this.selectedMode;
mode.selectedTimeSystem(newTimeSystem); mode.selectedTimeSystem(newTimeSystem);
this.setDeltasFromTimeSystem(newTimeSystem); this.setDeltasFromTimeSystem(newTimeSystem);