Skip to content

Commit

Permalink
[fix] Have a default until before a default from. Fixes #478.
Browse files Browse the repository at this point in the history
  • Loading branch information
indexzero committed Dec 30, 2014
1 parent 1663daa commit 5109dd0
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions lib/winston/transports/transport.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,18 +61,19 @@ Transport.prototype.normalizeQuery = function (options) {
// starting row offset
options.start = options.start || 0;

// now - 24
options.from = options.from || new Date - (24 * 60 * 60 * 1000);
if (typeof options.from !== 'object') {
options.from = new Date(options.from);
}

// now
options.until = options.until || new Date;
if (typeof options.until !== 'object') {
options.until = new Date(options.until);
}

// now - 24
options.from = options.from || (options.until - (24 * 60 * 60 * 1000));
if (typeof options.from !== 'object') {
options.from = new Date(options.from);
}


// 'asc' or 'desc'
options.order = options.order || 'desc';

Expand Down

0 comments on commit 5109dd0

Please sign in to comment.