Comments (21)
Is there any way to use timezone in Angular 2 with pipes?
Help me!!!
from ngx-moment.
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.
from ngx-moment.
@mj1856 When this issue will be fixed?
--> Related: moment/moment-timezone#385
from ngx-moment.
@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);
from ngx-moment.
Hi,
How do you set it up for the timezone with angular1 ?
from ngx-moment.
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
from ngx-moment.
@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?
from ngx-moment.
Same problem here, and now, after updating moment, I can't even set the global locale, that sucks
from ngx-moment.
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).
from ngx-moment.
@rdicroce you may want to contribute this pipe in a PR so everyone can enjoy it
from ngx-moment.
@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);
}
});
from ngx-moment.
can we override to moment-timezone
instead of moment
?
from ngx-moment.
Related: moment/moment-timezone#385
from ngx-moment.
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
from ngx-moment.
Up
from ngx-moment.
In the meantime you can set the default with: moment.tz.setDefault(timezone);
from ngx-moment.
Can we have some information here ? I can't set the timezone manually.. it will not work in pipes.
from ngx-moment.
Hi!
Any new about this feature? How can we tell the amTimeAgo pipe to convert the date to client timezone?
from ngx-moment.
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
from ngx-moment.
In the meantime you can set the default with:
moment.tz.setDefault(timezone);
where in angular is the most appropriate place to set this
from ngx-moment.
+1
from ngx-moment.
Related Issues (20)
- amDateFormat does not refresh and and the browser is frozen
- Tslib missing from package.json file HOT 3
- amDuration set Humanize optionnal or create new pipe
- Check value emptiness in LocalTimePipe HOT 1
- Angular 8/9 HOT 1
- [docs] improve docs, how to import to core module HOT 1
- Support ng-add schematics HOT 1
- Setting relativeTimeThresholdOptions object doesn't work HOT 3
- Pipe could not be found with Angular 9 (Ivy enabled by default) HOT 7
- Problems with moment 2.25.0 HOT 16
- Getting warnings and errors related to moment and ngx-moment during compilation (ng serve) along with broken-page for timeago pipe HOT 1
- can't use amLocale with amLocal HOT 2
- ERROR Error: AddPipe: missing required arguments while using amAdd HOT 1
- ModuleWithProviders usage without type parameter no longer supported in angular 10. HOT 2
- Moment start with wrong time
- momentConstructor$a is not a function HOT 1
- i get warnings about pipes not being found despite importing everything HOT 2
- Errors since update to latest version (6.0.0) HOT 22
- Angular 13 + ngx-moment 6.0.2: This module is declared with using 'export = HOT 9
- amDateFormat - momentConstructor$9 is not a function HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ngx-moment.