get full year is not function in reactjs
yes there is a minor mistake of javascript Type Conversion
you can fix it like this
import './SubscriptionDate.css'
import Container from '../template/Container'
function SubscriptionDate(props){
const theDate = new Date(props.date)
const day = theDate.toLocaleString('default', {day:'2-digit'})
const month =theDate.toLocaleString('default', {month:'long'})
const year = theDate.getFullYear()
return(
<Container className="date">
<div className="day">{day}</div>
<div className="month">{month}</div>
<div className="year">{year}</div>
</Container>
)
}
export default SubscriptionDate
1 Like