[React Intl] Format a Date Relative to the Current Date Using react-intl FormattedRelative
React to The Using Date format Current Relative
2023-09-14 08:59:18 时间
Given a date, we’ll use the react-intl
FormattedRelative
component to render a date in a human readable format, such as “2 days ago”, in various languages.
We'll also see how to set the frequency of this component's rendering to make our app update the text in real-time.
<FormattedRelative value={new Date(review.date)} style="numeric" />
Since the FormattedRelative component udpate in real time, so you can also control the update interval:
<FormattedRelative value={new Date(review.date)} updateInterval={1000} style="numeric" />
Notice that it will cause extra unecessary component render.
相关文章
- react的jsx语法是怎样解析的
- React报错之Expected `onClick` listener to be a function
- SqlBulkCopy – The given value of type String from the data source cannot be converted to type
- 20道高频react面试题(附答案)
- 带你实现react源码的核心功能
- 问:你是如何进行react状态管理方案选择的?
- to program_I Just Want To
- react+antd组件 modal里面包裹使用form表单并获取提交事件
- 从react源码角度看React-Hydrate原理
- 你是如何使用React高阶组件的-面试进阶
- To add browser notifications to an online customer support live chat service system - gofly - self h
- React入门六: 组件基础练习
- react源码分析:babel如何解析jsx_2023-02-06
- 一文读透react精髓_2023-02-24
- 前端react面试题合集_2023-03-15
- ORA-31692: The following SQL statement failed trying to insert a row into the Master table: string ORACLE 报错 故障修复 远程处理
- ORA-32341: The EXPLAIN_MVIEW facility failed to explain the materialized view “string”.”string” ORACLE 报错 故障修复 远程处理