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

Timezones matching the current system timezone #55

Closed
emmanuel-vasseur opened this issue Jan 25, 2014 · 9 comments
Closed

Timezones matching the current system timezone #55

emmanuel-vasseur opened this issue Jan 25, 2014 · 9 comments

Comments

@emmanuel-vasseur
Copy link

Hello,

I need to know which timezones match the current system timezone, in order to do some date format manipulation on server side.
Few apis exists for this feature, and it is not a simple because in javascript we need to deal with timezone offset and test multiple dates.

However this thread on stackoverflow talks about this feature using moment timezone datas : http://stackoverflow.com/questions/19420582/detect-the-id-of-the-current-user-timezone-using-moment-js

I could simply used this peace of code but it can be certainly improve and why not include in moment timezone library.

The person that post this peace of code test the current date, the dates 4 and 8 months later and the same three dates five years before.
Is it a good strategy ? Can I improve it to have closer timezones matching ?

I need this feature so I can improve this peace of code with your advices and, if you're agreed, publish it in your repository.

@timrwood timrwood added pending and removed pending labels Jun 24, 2014
@timrwood
Copy link
Member

Yeah, I think user timezone detection would make sense to add to moment-timezone.

In the meantime though, you should check out https://bitbucket.org/pellepim/jstimezonedetect which will probably solve your use case.

@timrwood timrwood added this to the 0.2.0 milestone Jun 24, 2014
@mattjohnsonpint
Copy link
Contributor

I think this would be a very useful addition. But do consider that time zone detection is messy and error prone. Especially, consider that we would need to provide updates periodically to account for the ECMAScript 5.1 15.9.1.8 issue. Note that jsTimeZoneDetect has the same problem.

@bkCDL
Copy link

bkCDL commented Aug 25, 2014

👍

@hirbod
Copy link

hirbod commented Dec 24, 2014

Cool, was about to ask exact this question. I've also included https://bitbucket.org/pellepim/jstimezonedetect into my project to do some kind of this stuff here

var locale = moment.tz(date, $rootScope.defaultTimeZone).locale('de');
return locale.tz($rootScope.timezone).calendar();

So 👍

Would be a very big nice to have instead of relying again to another 3rd party solution.
Merry Christmas :)

@jd327
Copy link

jd327 commented Jan 8, 2015

+1

@kashifshamaz21
Copy link
Contributor

This feature request is a duplicate of #138, and i'm going to close this in favour of the other one as it has more discussions around the actual implementations.
Further discussions/suggestions on this feature should be carried over on #138, thanks.

@timrwood
Copy link
Member

I opened a PR for this at #220.

@timrwood
Copy link
Member

This has been released in [email protected] as moment.tz.guess().

@jd327
Copy link

jd327 commented Dec 28, 2015

Nice 👍

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

7 participants