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 support in the future? #39

Open
grapemix opened this issue May 23, 2016 · 21 comments
Open

Timezone support in the future? #39

grapemix opened this issue May 23, 2016 · 21 comments

Comments

@grapemix
Copy link

Thanks for the work of this lib.

Will timezone feature support in the future? Ideally, we can set timezone once instead of passing the timezone setting every time we used this lib.

Currently, if the input is "2016-05-23T00:39:23.610812Z" and the local time is 21:39, this lib does not show correctly because time zone feature has not been implemented. In Angular 1, everything is fine.

Thanks.

@urish
Copy link
Owner

urish commented May 23, 2016

Hi,

How do you set it up for the timezone with angular1 ?

@grapemix
Copy link
Author

grapemix commented May 23, 2016

I think the following post will explain better the solution than my word:

http://stackoverflow.com/questions/25283901/how-to-set-angular-moment-timezone-globally

@dragGH102
Copy link

dragGH102 commented May 24, 2016

@urish I'm also interested. I noticed in your angular-moment package you actually give an explanation on how to use moment**'-timezone**: https://github.com/urish/angular-moment

Also, does moment actual support half / three-quarter time zones?

@basvdijk
Copy link

I am also looking for a locale timezone supported feature. Currently when I use {{tdata.created | amTimeAgo}} it has a two hour offset from the current client timezone. I was wondering if I need to specify anything since the client timezone could be auto-detected.

@marcoskichel
Copy link

Same problem here, and now, after updating moment, I can't even set the global locale, that sucks

@rdicroce
Copy link

rdicroce commented Jul 7, 2016

I found a workaround, if the date to be parsed contains timezone information. You can make a custom Angular pipe that just parses the string using moment.parseZone(), then add that pipe before amDateFormat (or whatever pipe you're using).

@urish
Copy link
Owner

urish commented Jul 7, 2016

@rdicroce you may want to contribute this pipe in a PR so everyone can enjoy it

@rdicroce
Copy link

rdicroce commented Jul 7, 2016

@urish I'm building my app using straight JavaScript rather than TypeScript. The pipe's really simple though, so you shouldn't have any problem porting it to TS:

var ngCore = require('@angular/core');
var moment = require('moment');

exports.MomentParseZonePipe = ngCore.Pipe({
    name: 'momentParseZone'
})
.Class({
    constructor: function () {},
    transform: function (value) {
        return moment.parseZone(value);
    }
});

@kodeine
Copy link

kodeine commented Jul 28, 2016

can we override to moment-timezone instead of moment?

@mattjohnsonpint
Copy link

Related: moment/moment-timezone#385

@mattjohnsonpint
Copy link

@dragGH102

Also, does moment actual support half / three-quarter time zones?

Yes, moment-timezone supports the entire IANA time zone database, including strange oddities like Asia/Nepal and Australia/Eucla

@redmember
Copy link

@mj1856 When this issue will be fixed?
--> Related: moment/moment-timezone#385

@morriq
Copy link

morriq commented Dec 14, 2016

Up

@cur3n4
Copy link

cur3n4 commented Jan 25, 2017

In the meantime you can set the default with: moment.tz.setDefault(timezone);

@Yamilquery
Copy link

Is there any way to use timezone in Angular 2 with pipes?
Help me!!!

@JoaoPintoM
Copy link

Can we have some information here ? I can't set the timezone manually.. it will not work in pipes.

@BenDevelopment
Copy link

BenDevelopment commented Jul 9, 2017

Hi!
Any new about this feature? How can we tell the amTimeAgo pipe to convert the date to client timezone?

@morriq
Copy link

morriq commented Jul 10, 2017

@BenDevelopment just copy it to your project / or fork it on github.

It's easy to achieve. Just redefine this.lastText with:
this.lastText = moment.utc(value).local().from(moment(), omitSuffix);

@ryan-morris
Copy link

ryan-morris commented Dec 12, 2017

Any word on this? I have objects with full time/zone information 2017-12-12T16:12:00-05:00 but it gets changed to the browser time zone, I'd like to preserve the timezone from the input string when formatting, e.g shows 2017-12-12 17:12:00 when I use amDateFormat of YYYY-MM-DD HH:mm:ss in the html when on a browser set to -04:00 offset

@radiumrasheed
Copy link

In the meantime you can set the default with: moment.tz.setDefault(timezone);

where in angular is the most appropriate place to set this

@maenthoven
Copy link

+1

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

No branches or pull requests