9

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

palyxk
  • 341
  • 2
  • 4
  • 17
  • Can you add a link to the mentioned docs? – Icepickle May 07 '17 at 14:13
  • https://github.com/yahoo/react-intl/wiki/API#date-formatting-apis – palyxk May 07 '17 at 14:16
  • It seems all correct to me, also judging from this: https://github.com/yahoo/react-intl/wiki/Components#formatteddate , you cannot change the standard default format, or pass a custom format along? – Icepickle May 07 '17 at 14:18
  • You can change the style of every component but you cannot change their order. The order is defined by i18n. – Sulthan May 07 '17 at 14:24

1 Answers1

8

Try to combine with FormattedTime of the same library

<FormattedTime value={myDate}/>,&nbsp;<FormattedDate
  value={myDate}
  day="numeric"
  month="long"
  year="numeric"/>
bonheury
  • 362
  • 1
  • 5
  • 14