Skip to content

Commit

Permalink
fix(core): read displayTimestampsInUserLocalTime off SETTINGS.feature
Browse files Browse the repository at this point in the history
  • Loading branch information
maggieneterval committed Feb 5, 2019
1 parent 1f03ebe commit cf861ba
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/scripts/modules/core/src/config/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export interface IFeatures {
[key: string]: any;
canary?: boolean;
chaosMonkey?: boolean;
displayTimestampsInUserLocalTime?: boolean;
dockerBake?: boolean;
entityTags?: boolean;
fiatEnabled?: boolean;
Expand Down Expand Up @@ -86,7 +87,6 @@ export interface ISpinnakerSettings {
defaultProviders: string[];
defaultTimeZone: string; // see http://momentjs.com/timezone/docs/#/data-utilities/
dockerInsights: IDockerInsightSettings;
displayTimestampsInUserLocalTime: boolean;
entityTags?: {
maxUrlLength?: number;
};
Expand Down
2 changes: 1 addition & 1 deletion app/scripts/modules/core/src/utils/timeFormatters.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ describe('Filter: timeFormatters', function() {
expect(filter(1445707299020)).toBe('2015-10-24 17:21:39 GMT');
});
it('returns formatted date in user local time when valid value is provided', function() {
SETTINGS.displayTimestampsInUserLocalTime = true;
SETTINGS.feature.displayTimestampsInUserLocalTime = true;
spyOn(moment.tz, 'guess').and.callFake(function() {
return 'Asia/Tokyo'; // +09:00
});
Expand Down
2 changes: 1 addition & 1 deletion app/scripts/modules/core/src/utils/timeFormatters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export function timestamp(input: any) {
if (!isInputValid(input)) {
return '-';
}
const tz = SETTINGS.displayTimestampsInUserLocalTime ? moment.tz.guess() : SETTINGS.defaultTimeZone;
const tz = SETTINGS.feature.displayTimestampsInUserLocalTime ? moment.tz.guess() : SETTINGS.defaultTimeZone;
const thisMoment = moment.tz(parseInt(input, 10), tz);
return thisMoment.isValid() ? thisMoment.format('YYYY-MM-DD HH:mm:ss z') : '-';
}
Expand Down

0 comments on commit cf861ba

Please sign in to comment.