Timo Martinson
Timo Martinson11mo ago

Typing DateTimes

interface ICity {
slug: string
name: string
description?: string
createdAt: Date
updatedAt: Date
}
interface ICity {
slug: string
name: string
description?: string
createdAt: Date
updatedAt: Date
}
can I save strings like "2023-09-10 18:16:00" as createdAt and updatedAt ?
5 Replies
Timo Martinson
Timo Martinson11mo ago
or what format should a Date have?
ня, привет
Date should have Date class
Timo Martinson
Timo Martinson11mo ago
can't I use simple "string"-dates ?
NeTT
NeTT11mo ago
nope no but you can use new Date(your_string) to convert them
NeTT
NeTT11mo ago