-
Notifications
You must be signed in to change notification settings - Fork 91
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
NcDatetime: New component for displaying timestamps as time relative from now #4219
Conversation
ℹ️ Fixed the tests by enforcing
does not to work |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice addition. Tested in the docs and it works nicely
Would it be possible to have a prop that allows to show just "a few seconds ago" until the first minute instead of each and every second?
*/ | ||
format: { | ||
type: Object, | ||
default: () => ({ timeStyle: 'medium', dateStyle: 'short' }), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it make sense to separate these into two separate props?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which two properties? title format and main format?
Or do you mean timeStyle
and dateStyle
?
If the latter one, then I do not think so. As there are more options possible I just allowed every Intl.DateTimeFormatOptions
option (which allow finer control over the style by setting the format of weekday, hour, month...
directly).
Sure, something like |
@marcoambrosini This is now implemented :) |
…e from now This implements a component showing for displaying timestamps like *x seconds ago* without the need of huge libraries like moment.js Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Will this have any effect on nextcloud-libraries/nextcloud-moment#407? |
@Chartman123 Not really, |
☑️ Resolves
This implements a component showing for displaying timestamps like x seconds ago without the need of huge libraries like moment.js. It is based on the
Intl
browser API, which is supported by all of our browser targets.Tests included.
🖼️ Screenshots
🏁 Checklist