[React Intl] Format a Date Relative to the Current Date Using react-intl FormattedRelative
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 Intl] Format a Date Relative to the Current Date Using react-intl FormattedRelative的更多相关文章
- [React Intl] Format Date and Time Using react-intl FormattedDate and FormattedTime
Using the react-intl FormattedDate and FormattedTime components, we’ll render a JavaScript Date into ...
- java中setDate(Date date)方法和String与Date之间的转换
经常在开发的过程中遇到这样的问题,从数据库中读出来的数据需要转换为对像或者java bean,此时经常使用到setDate(Date date);这样的方法.感觉这是个很简单而又难受的事情,在这里浪费 ...
- 【转】Date类学习总结(Calendar Date 字符串 相互转换 格式化)
原文网址:http://www.blogjava.net/jerry-zhaoj/archive/2008/10/08/233228.html Date类学习总结 1.计算某一月份的最大天数 Cale ...
- javascript 的Date 格式化, 模仿shell中date命令的格式
原文:javascript 的Date 格式化, 模仿shell中date命令的格式 shell 中显示当前的日期 [root@localhost]$ date '+%Y-%m-%d %H:%M:%S ...
- jackson/fastjson、mybatis、mysql date/datatime/timestamp、java Date/Timestamp关系详解
jackson/fastjson序列化/反序列化: 默认情况下,jackson/fastjson将java Date/Timestamp类型序列化为时间戳,也就是1970年1月1日0点以来的毫秒数.如 ...
- Java – How to add days to current date
1. Calendar.add Example to add 1 year, 1 month, 1 day, 1 hour, 1 minute and 1 second to the current ...
- Java – How to get current date time
Java – How to get current date time 1. Code SnippetsFor java.util.Date, just create a new Date() Dat ...
- Date类学习总结(Calendar Date 字符串 相互转换 格式化)
Date类学习总结 1.计算某一月份的最大天数 Calendar time=Calendar.getInstance();time.clear();time.set(Calendar.YEAR,yea ...
- 对Date的扩展,将 Date 转化为指定格式的String
<script language="javascript" type="text/javascript"><!-- /** * 对Date的扩 ...
随机推荐
- Java编程思想(四) —— 复用类
看了老罗罗升阳的专訪,不由自主地佩服,非常年轻,我之前以为和罗永浩一个级别的年龄.也是见过的不是初高中编程的一位大牛之中的一个,专訪之后.发现老罗也是一步一个脚印的人. 别说什么难做,做不了.你根本就 ...
- java一个月日历
项目须要,获取当天之后的30天.并提示星期几(周几),写了一个工具类 /** * 计算日期时间 * @author shijing * 2015年8月10日下午2:16:09 * @param dat ...
- js call 和 apply
前言 call 和 apply 都是为了改变某个函数运行时的 context 即上下文而存在的,换句话说,就是为了改变函数体内部 this 的指向. call 和 apply二者的作用完全一样,只是接 ...
- Token ,Cookie和Session的区别--学习笔记
http://blog.csdn.net/tobetheender/article/details/52485948 Token token的意思是“令牌”,是用户身份的验证方式,最简单的token组 ...
- 在Xampp中添加memache扩展
1.首先下载phpmemcache,地址为: http://up.2cto.com/2012/0522/20120522094758371.rar 解压下的文件,解压后有以下文件: 接着以管理员身份打 ...
- 关于IDEA编译器在初次使用thymeleaf 引入无效 , 导致th无法使用的原因
首先pom.xml里面要导入thymeleaf的依赖 然后在html中加入 xmlns:th="http://www.thymeleaf.org" 最后点击file ---> ...
- Android 打造属于自己的RxBus
RxBus 通过RxJava实现Rxbus. 相信大家已经非常熟悉EventBus了.最近正在学习Rxjava,如果在项目中已经使用了Rxjava,使用RxBus来代替EventBus应该是不错的选择 ...
- Winform 获取相对路径 C#
///获取相对路径 ///例如:System.Windows.Forms.Application.StartupPath = "E:\App\CheckingMachine\QueryMac ...
- go reflect 调用方法
package main import ( "fmt" "reflect" ) type A struct { } func (A) Test() { fmt. ...
- Linux登录状态
1.hostname 显示主机名称.设置主机名称 1)显示主机名称 xiaohuang@xiaohuang-virtual-machine:~$ hostname xiaohuang-virtual- ...