[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的扩 ...
随机推荐
- UML图和C#
这段时间学习了楚光明老师解说的C#视频,接触这个学习材料的第一感觉就是老师解说的通俗易懂,非常easy让人去接受:再有就是在学习到UML图和C#的一节时非常有收获,之前自己也学习过UML图的一 ...
- HDU 4786 Fibonacci Tree 生成树
链接:http://acm.hdu.edu.cn/showproblem.php?pid=4786 题意:有N个节点(1 <= N <= 10^5),M条边(0 <= M <= ...
- leetCode 85.Maximal Rectangle (最大矩阵) 解题思路和方法
Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and ...
- C#运算符小例子
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...
- 8.ZOrder
T3LayerZorder.h #pragma once #include "cocos2d.h" USING_NS_CC; class T3LayerZorder:public ...
- Kinect 开发 —— WaveHand
基本注释都写了,就不废话了 <Window x:Class="KinectBasicHandTrackingFrameworkTest.MainWindow" xmlns=& ...
- kafka删除主题
hdp集群默认不能删除kafka主题,如果要删除,需要在ambari上进行配置,将enable delete设置为true.
- pwconv---pwunconv 密码投影
pwconv命令用来开启用户的投影密码.Linux系统里的用户和群组密码,分别存放在名称为passwd和group的文件中, 这两个文件位于/etc目录下.因系统运作所需,任何人都得以读取它们,造成安 ...
- 【Codeforces Round #427 (Div. 2) A】Key races
[Link]:http://codeforces.com/contest/835/problem/A [Description] [Solution] 傻逼题. [NumberOf WA] [Revi ...
- Android网络通信Volley框架源代码浅析(一)
尊重原创http://blog.csdn.net/yuanzeyao/article/details/25837897 从今天開始,我打算为大家呈现关于Volley框架的源代码分析的文章,Volley ...