Skip to content
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

n-time相对时间最小值希望精确到秒 #2703

Closed
Baiyuetribe opened this issue Mar 30, 2022 · 4 comments
Closed

n-time相对时间最小值希望精确到秒 #2703

Baiyuetribe opened this issue Mar 30, 2022 · 4 comments
Labels
feature request New feature or request priority: low

Comments

@Baiyuetribe
Copy link
Contributor

This function solves the problem (这个功能解决的问题)

使用场景:websocket搭建实时监控面板,一些场景下当前相对时间最小值仅显示“不到一分钟内”,这粒度感觉怪怪的,希望将一分钟内精确到秒。

Expected API (期望的 API)

n-time相对时间的一分钟内精确到秒,小于1分钟后显示几秒前。

@github-actions github-actions bot added the feature request New feature or request label Mar 30, 2022
@Baiyuetribe
Copy link
Contributor Author

参考了下date-fns的api,目前naive-ui调用了formatDistance所以返回值比较粗略。精确到秒只需要替换为formatDistanceStrict这个api就行,看下直接替换?还是另外加个Strict属性
参考自:https://date-fns.org/v2.28.0/docs/formatDistanceStrict

@Baiyuetribe
Copy link
Contributor Author

最常用的还是距离现在的相对时间,干脆另外加一个props属性,然后加上formatDistanceToNowStrict这个api。就可以精确显示。

@07akioni
Copy link
Collaborator

我这周看一下

@07akioni
Copy link
Collaborator

closed in #2714

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request priority: low
Projects
None yet
Development

No branches or pull requests

2 participants