Giter VIP home page Giter VIP logo

Comments (6)

patrik7 avatar patrik7 commented on July 17, 2024 1

Hi @jeevasusej,

As mentioned, you need to make sure the plugin receives a TZ aware timestamp.

So instead of passing
from-time="2016-06-02T10:20:28.130509"

I passed:
from-time="2016-06-02T10:20:28.130509+02:00"

This way angular-timeago know in that TZ the timestamp is and can correctly show it in browsers/users TZ.

Hope that makes sense.

from angular-timeago.

astik avatar astik commented on July 17, 2024

Can you provide us a code example with the problem and what you are expecting ?
I don't understand your request right now =/

from angular-timeago.

patrik7 avatar patrik7 commented on July 17, 2024

Hi astik,

Of course, sorry for being too vague.

<time-ago class="datetime" from-time="{{m.datetime}}" format='MM/dd/yyyy'></time-ago>

m.datetime is a string in ISO format: %Y-%m-%dT%H:%M:%S

Now let's say timestamp it's 1pm UTC, the server will render 2016-06-01T13:00:00 as m.datetime

And currently is 2pm UTC (so one hour later), I would expect the time-ago to output "one hour ago".

However, my browser being on CEST, the time-ago actually outputs "3 hours ago". Seems like it assumes that the m.datetime timestamp is in my local TZ.

Patrik

from angular-timeago.

patrik7 avatar patrik7 commented on July 17, 2024

I solved it by rendering TZ into the string on server:
datetime: '2016-06-02T10:20:28.130509+02:00'

We can close this, thanks for your time

from angular-timeago.

astik avatar astik commented on July 17, 2024

No problem, glad you find your way out =)

from angular-timeago.

jeevasusej avatar jeevasusej commented on July 17, 2024

@patrik7, How did you solve? Can you paste the code?

from angular-timeago.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.