Giter Site home page Giter Site logo

Comments (6)

SirRawlins avatar SirRawlins commented on May 30, 2024

I think in order to do this, we'll need to add the datetime stamp to the 'duration' span, and then we can have moment.js pick up on it, and render the duration, rather than relying on the value from the server, which is outdated when the cache is stale/

from theme-whitelabel.

SirRawlins avatar SirRawlins commented on May 30, 2024

We actually already have some JS which we can lean on for this:

https://github.com/sorry-app/theme-whitelabel/blob/master/src/javascripts/status-page.js#L18

So we should just be able to wrap the "duration" in a tag with the appropriate class and it'll render as a duration.

from theme-whitelabel.

SirRawlins avatar SirRawlins commented on May 30, 2024

Actually, the duration JS we already have can't be used, as it expected a fixed duration, which is what we're trying to avoid. We want something which calculates the duration/distance of time in words from a fixed DateTime.

from theme-whitelabel.

SirRawlins avatar SirRawlins commented on May 30, 2024

I think I might replace the existing JS for a new one which will handle both duration and DateTime strings.

The duration can be described using the ISO format which it appears that Moment.js can parse.

This will DRY the existing code up a little, and also mean we can use some markup which will work for both past and present notices.

from theme-whitelabel.

SirRawlins avatar SirRawlins commented on May 30, 2024

After playing around with some JS ideas, they all felt a bit hacky.

After some discussions internally, we've decided to drop 'duration' from current incidents, so it's only available once static on old notices, which resolves our conflict with the cache.

I've updated the app so that duration() now returns nil for present notices, so we can make it's output conditional on the page.

from theme-whitelabel.

SirRawlins avatar SirRawlins commented on May 30, 2024

This has now been released in 2.46.0

from theme-whitelabel.

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.