Reputation: 1829
If the data does not exist in the database, there's no error but it will just display an Invalid Date on the screen. How can I do this where if the data does not exist in the database, then it will just be empty.
First Item:
{new Date(
user.items?.firstDateseconds * 1000
).toDateString()}
Upvotes: 0
Views: 89
Reputation: 8412
new Date()
Something like this:
First Item: {
user.items?.firstDateseconds
? new Date(user.items.firstDateseconds * 1000).toDateString()
: '';
}
Upvotes: 3