I might have gotten things all messed up, but I'm trying to build something using only Next.js where if a certain date has passed, my todo items should become visible.
I know I can't simply use new Date() in the client, because that would make it possible for anyone to manipulate the time of the client to render the content visible.
So my question is, it is possible doing something like this with Next.js's built in api?
/api/todos.js
export default function handler(req, res) {
const now = new Date();
res.status(200).json([
{
title: 'Todo 1',
id: 1,
isOpened: false,
canBeOpened: now >= new Date('2021-12-01'),
},
{
title: 'Todo 2',
id: 1,
isOpened: false,
canBeOpened: now >= new Date('2021-12-02'),
},
]);
}
I'm planning on hosting this on netlify, but I'm not sure what time they might be using. Is this approach possible?