Good morning everyone, I come from the java world and am starting in NodeJS.
I'm having a hard time understanding how to work with dates and times in NodeJS.
Here is an example of the template I want to use:
export interface teste extends mongoose.Document {
descricao: string,
dataTeste: ????,
horarioInicial: ????,
horarioFinal: ????,
dataHoraRegistro: ????
}
const testeSchema = new mongoose.Schema({
descricao:{
type: String,
required: true,
maxlength: 200,
minlength: 3
},
dataTeste:{
type: ?????,
required: true
},
horarioInicial:{
type: ?????,
required: true
},
horarioFinal:{
type: ?????,
required: true
},
dataHoraRegistro:{
type: ?????,
required: true
}
}
export const Teste = mongoose.model<Teste>('Teste', testeSchema)
In all the places I left ???? I do not know what to put.
- In the dataset field I need to record only dates, not the time.
- In the StartTime and EndTime fields I need to store only hours, no dates.
- In the DateTime field I need to store the moment something happened (date and time).
How do you do this?