Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Intl Formatting date

Tags:

reactjs

intl

i have incoming date in exactly like this string:

myDate= ' 2017-05-05T12:24:06+0000'

i am using FormattedDate from 'react-intl' to achieve my desired format

12:24, 5 May 2017

But with this code:

<FormattedDate
  value={myDate}
  day="numeric"
  month="long"
  year="numeric"
  hour="numeric"
  minute="numeric"/>

i am getting this :

May 5, 2017, 12:24 

i must be doing something wrong. Or misunderstood docs. Can you advise me ?

I

like image 421
palyxk Avatar asked May 07 '17 14:05

palyxk


1 Answers

Try to combine with FormattedTime of the same library

<FormattedTime value={myDate}/>,&nbsp;<FormattedDate
  value={myDate}
  day="numeric"
  month="long"
  year="numeric"/>
like image 87
bonheury Avatar answered Nov 09 '22 07:11

bonheury