react-intl FormattedDate Shows Prior Date for YYYY-MM-DD value

1.2k views Asked by At

Please note I'm new to react-intl. I have the following date I want to display:

d1_date: "2012-03-26" //goal to display March 26, 2012

I use react-intl's

FormattedDate

to display the date:

<FormattedDate value={d1_date} year='numeric' month='long' day='2-digit' />

and I get the following result:

March 25, 2012

I know the d1_date doesn't have time information. Do I need to manipulate d1_date so that a bogus time appears allowing the true date to reflect "March 26, 2012"?

1

There are 1 answers

0
banyan On BEST ANSWER
<FormattedDate value={new Date('2012-03-26')} year='numeric' month='long' day='2-digit' />

I think it requires Date instance.