Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timezone offset - Disable UTC mode from Momentjs #30

gagle opened this issue Dec 31, 2014 · 2 comments · Fixed by #31

Timezone offset - Disable UTC mode from Momentjs #30

gagle opened this issue Dec 31, 2014 · 2 comments · Fixed by #31


Copy link

@gagle gagle commented Dec 31, 2014

Currently the UTC mode from Momentjs is being used. This disables the timezone offset and is always set to 0.

Could you remove that UTC mode? You simply need to create Moment objects without calling to the utc() function, just doing Moment(...) instead of Moment.utc(...).

I want to print the timestamp in the ISO format by passing format: '' as a parameter to the good-console reporter.

@arb arb self-assigned this Dec 31, 2014

This comment has been minimized.

Copy link

@arb arb commented Dec 31, 2014

I think having the time expressed as UTC is much more useful than being able to express the timezone. By using UTC, you don't even need a zone so I'm not sure really what the use case of this is. Working with UTC also makes testing easier because the time is the time, regardless of where your computer is sitting.

If you truely need this feature, good-console is small enough for you to fork and implement on your own. It is unlikely that this will change here however.

@arb arb closed this Dec 31, 2014

This comment has been minimized.

Copy link

@gagle gagle commented Jan 5, 2015

Sorry but I don't agree with you. Typically, the console output is used for debugging purposes in the development environment. I'm living in Spain and we currently have +1 offset, so when Hapi sends a log to the console, instead of displaying our current hour, say 16:00, it logs the UTC hour, 15:00. I develop in my local machine, so I would like to seethe local time of my machine.

By disabling the UTC mode you're not losing anything, but if you leave it enabled, you're just not letting the users to display the correct local time.

var moment = require('moment');
console.log(moment().utc().format()); // 2015-01-05T15:32:09+00:00
console.log(moment().format()); // 2015-01-05T16:32:09+01:00

If you simply remove the utc() function, you'll be allowing local time.

Alternatively, you can add an utc option. When true, momentjs will use the utc() mode.

arb added a commit to arb/good-console that referenced this issue Jan 5, 2015
@arb arb reopened this Jan 5, 2015
@arb arb added the feature label Jan 5, 2015
@arb arb added this to the 4.0.1 milestone Jan 5, 2015
@arb arb mentioned this issue Jan 5, 2015
@geek geek closed this in #31 Jan 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.