Skip to content

Conversation

@friedbunny
Copy link

Use moment.js to add option to display timestamps in local time, but default to UTC. Also add the option to customize the time formatting, using moment.js conventions.

Adds moment.js dependency.

Adds options:

config.UTC: TRUE
config.timeFormat: moment.defaultFormat

Use moment.js to add option to display timestamps in local time, but default to UTC. Also add the option to customize the time formatting, using [moment.js conventions](http://momentjs.com/docs/#/displaying/format/).

Add `config.UTC: TRUE`, `config.timeFormat: moment.defaultFormat`
@coveralls
Copy link

Coverage Status

Coverage decreased (-27.56%) when pulling d4784b7 on friedbunny:local-timezone into 3be44f0 on mrrama:master.

@friedbunny
Copy link
Author

Just a note: rudely, my PR does break the tests and changes the default time format to YYYY-MM-DDTHH:mm:ssZ, i.e., 2014-11-10T23:55:42-00:00. Moment.js converts Z to 00:00 for UTC, while bunyan leaves it as simply Z, i.e., 2014-11-10T23:55:42:20Z.

Old format would be 'YYYY-MM-DDTHH:mm:ss:SS[Z], but this doesn't convert Z to the proper zone. I'm lazy and didn't bother to hack around this, sorry.

This seems like a moment.js bug, actually... I couldn't get moment.toISOString() to actually do what their docs said it would.

@coveralls
Copy link

Coverage Status

Coverage decreased (-27.56%) when pulling 1ca794b on friedbunny:local-timezone into 3be44f0 on mrrama:master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants