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

Show time in different timezone #30

Open
Ashish-Bansal opened this issue Jun 12, 2017 · 8 comments
Open

Show time in different timezone #30

Ashish-Bansal opened this issue Jun 12, 2017 · 8 comments

Comments

@Ashish-Bansal
Copy link

Is there any option by which I can make it display time in specific timezone ?

@ftm
Copy link
Contributor

ftm commented Jun 12, 2017

Not currently, however it doesn't seem like it would be too difficult to support offsets like "+05:00", see documentation here, but if you wanted to be able to set things like "Australia/Sydney" you should use moment-timezone.

@b3by
Copy link
Owner

b3by commented Jun 12, 2017

This could also be a good idea. I'm thinking, the tooltip could also be tweaked so it shows the time in a different timezone. Still not sure.

@ftm
Copy link
Contributor

ftm commented Jun 13, 2017

Using moment-timezone seems simple enough:

var moment = require('moment-timezone')

var timezone = "America/New_York"
var locale = "en"
var format = "h:mm a Z"

var timeLocal = moment().locale(locale).format(format)

var timeTimezone = moment().tz(timezone).locale(locale).format(format)

console.log(`Local: ${timeLocal}`)
console.log(`${timezone}: ${timeTimezone}`)
Local: 5:27 pm +01:00
America/New_York: 12:27 pm -04:00

@gwax
Copy link

gwax commented Jul 5, 2017

Related, I would love to be able to have the clock display UTC so I know what time it is on my servers.

@ftm
Copy link
Contributor

ftm commented Jul 5, 2017

Perhaps a checkbox in the settings to toggle between local time and UTC or maybe allow the user to click the time to toggle it between UTC and local time?

moment.js provides a .utc() method which seems to do the trick.

I don't mind writing this up and doing the PR if you want?

@b3by
Copy link
Owner

b3by commented Sep 4, 2017

I created a timezone branch with the first version of the timezone feature. However, the UTC option is available as timezone, so probably the UTC settings item can be removed. This would limit the customization for UTC only. A CSS class could still be added whenever the timezone is changed from the default one.

@KeithETruesdell
Copy link

could there also possibly be an update to display two timezones if possible? possibly to have one in UTC and the other in your local? Or to have a UTC Offset field with that?

@b3by
Copy link
Owner

b3by commented Nov 5, 2018

Maybe this can be integrated with the time format. However, in order to do that, a regex-like format should be parsed. I'm thinking about it, I've had much to do at work so I left this project a bit behind. I'll see if I can get some time to work on the timezone feature.

sigod pushed a commit to sigod/atom-clock that referenced this issue Apr 7, 2020
sigod pushed a commit to sigod/atom-clock that referenced this issue Apr 7, 2020
sigod pushed a commit to sigod/atom-clock that referenced this issue Apr 7, 2020
sigod pushed a commit to sigod/atom-clock that referenced this issue Apr 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants