I'm running an application where a timestamp is generated whenever a column from the backend is updated. On the frontend I'm able to read that timestamp, however, I'm struggling to format it.
The simplest thing I tried to do was to apply
portal.manager.updated_at.toISOString().substring(0, 10)
but I got: ".toISOString is not a function"
.
Also, where should I format this value? In the backend or in the frontend? This value is being generated by TypeORM with SQLite.
Column Definition:
{
name: 'updated_at',
type: 'timestamp',
default: 'now()',
},
At the model:
@UpdateDateColumn()
updated_at: Date;
In the Frontend:
type Portal = {
name: string;
manager: {
updated_at: Date;
};
}
export default function Portals() {
return (
<div>
<h1>{portal.manager.updated_at}</h1>
</div>
);
Thanks a lot!