I’m using react-admin v4 <FunctionField /> component to render a year that a review was created. the render function I’m supplying it is as follows:
const roughYear = (rec: RaRecord) => {
if (rec.CREATED) {
return rec.CREATED.substring(0,4);
}
const curTime = new Date();
return curTime.getFullYear()
And here is the FunctionField component:
<Labeled label="Year"
<FunctionField source="reveiw-year" render={roughYear} />
</Labeled>
Result is nothing, not even the current year if there is no rec.CREATED
I’ve tried putting the roughYear function inside the render prop itself, and even JUST returning the current year, but nothing seems to be working.