Comments (6)
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.
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.
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.
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.
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.
This has now been released in 2.46.0
from theme-whitelabel.
Related Issues (20)
- Use of target="_blank" is considered insecure HOT 1
- Add Portuguese (Brazilian) Translations HOT 1
- Display began_at/ended_at timestamps on notices HOT 2
- Add support for the new "drill" state HOT 2
- Stop using partials/includes for things which are not reusable.
- Switch from tabs to spaces
- Drop the "overview" heading on planned notices
- Move rendering of planned notice schedule out of the "update" partial. HOT 1
- Include "timeliness" on present notices.
- Restructure the "timeliness" section to include began, ended and duration, like publishing UI from app.
- Add Lithuanian language support HOT 1
- Began/Ended timstamps are missing the timezone HOT 1
- Add support for Microsoft Teams subscription
- Add Portuguese language support HOT 1
- Improve styling for rich content in notice updates HOT 2
- Add the Norwegian language HOT 3
- Fonts don't encode into Base64 very well (Cloudflare) HOT 5
- Fix German language content HOT 1
- Improve ordering of past notices HOT 1
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 theme-whitelabel.