-
Notifications
You must be signed in to change notification settings - Fork 46
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
Feature: uui-time-ago #143
Comments
@nielslyngsoe I just saw this on Twitter: https://twitter.com/Steve8708/status/1504131981444980739 Maybe a similar utility function? |
@nielslyngsoe you may also want to look at this example to render relative time, which also use |
FYI, GitHub (the org) has a bundle of elements that extend the native I found these on the Awesome Standalones repo, (for framework-agnostic standalone web components). |
@leekelleher that's probably a good idea to extend the native It also use Update: I think these functions were moved to here: https://github.com/github/relative-time-element/blob/main/src/relative-time-element.ts#L116-L200 |
@bjarnef you planning on working this, if not I may try and give this a go :) |
@warrenbuckley not yet, so feel free start working on this :) |
@warrenbuckley great that you'd like to take a stab at it! FYI, the component should handle the |
@iOvergaard the component could probably observe document I think they handled English as the default/fallback language as part of the localization utility. Not sure if the localization in UI library or backoffice is aware of the locale/culture, but also other stuff like direction (LTR / RTL). It seems the direction in that library was defined in each language: |
No, probably not, but how does it get the backoffice language. Does the Intl Api get it from the lang attribute automatically? |
@iOvergaard this project https://github.com/github/relative-time-element seems to get language from closest Regarding |
|
@bjarnef you seem to be more active on this and realistically with my workload and little free time I doubt I will get to this, so if you have been working on this please feel free to as I won't be right now. |
This component shall make it easy to display when something occurred. For shorter periods it will be precise and as time passes the precision will decrease.
A tooltip appearing on hover (For A11Y it might appears on focus or the tooltip can be opened by interaction/keyboard), The tooltip should display the exact time of the occurrence, as full DateTime string, like 1. January 2022 16:04:34
Examples of different appearances depending on the time since the given date-time:
now
28 seconds ago
16 minutes ago
3 hours ago
yesterday
4 days ago
last month
2 months ago
1 year ago
24 years ago
This should preferably update runtime, meaning example the second's display will update every second, to match the exact time difference.
I´m not sure how to determine when it makes sense to write yesterday etc. It would seem weird to write yesterday for 23:59 viewed at 00:01 (2minuts after). There should be a certain threshold before writing such. This has to be clarified how a system like that can work, if it does not make sense to use the words "yesterday"/"last month" then that should be kept out.
The text was updated successfully, but these errors were encountered: