How to format date as long inside reactjs component?

Posted by Jessica Taylor | Updated on

Want to format date as long inside reactjs component? Just do it in JS the usual way, before you start your return, and just template that in:

And there are quite a few ways you can do the string formatting, Date has a number of them built in (like toLocaleString or toUTCString), or you can use a dedicated formatter like moment.js.


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers