Skip to content

Commit c37a6d2

Browse files
committed
Fix timestamp output
Timestamps used a wrong moment format. We need to make sure to use "YYYY/MM/DD HH:mm:ss" when we want to display datetimes in the logging output.
1 parent db295f3 commit c37a6d2

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ module.exports = {
4747
var value = revision[key.name] ? revision[key.name] : "";
4848

4949
if(key.name === 'timestamp') {
50-
value = moment(value).format("YYYY/MM/DD HH:MM:SS");
50+
value = moment(value).format("YYYY/MM/DD HH:mm:ss");
5151
}
5252

5353
if(key.maxLength !== -1) {

tests/unit/index-nodetest.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
/*jshint globalstrict: true*/
22
'use strict';
33

4-
var RSVP = require('ember-cli/lib/ext/promise');
4+
var RSVP = require('ember-cli/lib/ext/promise');
5+
var moment = require('moment');
56

6-
var assert = require('ember-cli/tests/helpers/assert');
7+
var assert = require('ember-cli/tests/helpers/assert');
78

89
describe('displayRevisions plugin', function() {
910
var subject, mockUi, config;
@@ -148,10 +149,14 @@ describe('displayRevisions plugin', function() {
148149
assert.equal(messages.length, 0);
149150
});
150151

151-
it('transforms timestamps to human-readable dates', function() {
152+
it('transforms timestamps to human-readable dates (YYYY/MM/DD HH:mm:ss)', function() {
152153
plugin.displayRevisions(context);
154+
var utcOffset = moment().utcOffset();
155+
var expectedFormat = ('YYYY/MM/DD HH:mm:ss');
156+
var expectedDate = moment(1438232435000).utcOffset(utcOffset).format(expectedFormat);
157+
153158
var messages = mockUi.messages.reduce(function(previous, current) {
154-
if (current.indexOf("2015/07") !== -1) {
159+
if (current.indexOf(expectedDate) !== -1) {
155160
previous.push(current);
156161
}
157162

0 commit comments

Comments
 (0)