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

amTimeAgo with different timezones #150

Open
nicolassharp opened this issue Jun 23, 2017 · 4 comments
Open

amTimeAgo with different timezones #150

nicolassharp opened this issue Jun 23, 2017 · 4 comments

Comments

@nicolassharp
Copy link

nicolassharp commented Jun 23, 2017

I have an issue at the moment where my server returns a timestamp in UTC, and the user's computer is UTC + 1 (BST). This means that an action they just performed says '1 hour ago'.

I'm using {{activity.timestamp | amTimeAgo}}, would {{activity.timestamp | amUtc | amTimeAgo}} fix this?

I would just test myself but I don't have access to the endpoint right now.


Update: I've now tested using {{activity.timestamp | amUtc | amTimeAgo}} and unfortunately it doesn't fix the error.

@nicolassharp
Copy link
Author

nicolassharp commented Jul 5, 2017

Has no one faced this issue? Any help would be really appreciated!

@connormlewis
Copy link
Contributor

Does the time returned from the server have timezone information in it? Could you provide sample data? I believe the amUtc pipe just puts the moment object in UTC mode, which just changes how the information is displayed/manipulated.

@connormlewis
Copy link
Contributor

@nicolassharp give {{ activity.timestamp | amFromUtc | amLocal | amTimeAgo }} a try. The amLocal may not be necessary, but you could try it just to be safe. Make sure you’re on version 1.7.0 of this package.

@Roshan2892
Copy link

@connormlewis Thanks your solution worked for me. But can you explain what's exactly happening in your snippet?

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

3 participants