Skip to content

Commit

Permalink
padded pretty date in logs.
Browse files Browse the repository at this point in the history
  • Loading branch information
fahad19 committed Dec 29, 2016
1 parent 70acc5c commit d72a158
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/createStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,15 @@ class BaseStore {
.scan((previousState, action) => {
let updatedState;
const d = new Date();
const prettyDate = `${d.getHours()}:${d.getMinutes()}:${d.getSeconds()}.${d.getMilliseconds()}`;
const prettyDate = [
_.padStart(d.getHours(), 2, 0),
':',
_.padStart(d.getMinutes(), 2, 0),
':',
_.padStart(d.getSeconds(), 2, 0),
'.',
_.padStart(d.getMilliseconds(), 3, 0)
].join('');

try {
updatedState = this.options.reducer(previousState, action);
Expand Down

0 comments on commit d72a158

Please sign in to comment.