I come from the java world and I'm starting in NodeJS. I'm having a hard time understanding how to work with dates and times in NodeJS.
Only dates and only hours.
Here is an example:
export interface teste extends mongoose.Document {
    description: string,
    dateTest: ????,
    openingTime: ????,
    finalTime: ????,
    dateTimeRecord: ????
}
const testeSchema = new mongoose.Schema({
    description:{
        type: String,
        required: true,
        maxlength: 200,
        minlength: 3
    },
    dateTest:{
        type: ?????,
        required: true
    },
    openingTime:{
        type: ?????,
        required: true
    },
    finalTime:{
        type: ?????,
        required: true
    },
    dateTimeRecord:{
        type: ?????,
        required: true
    }
}
export const Teste = mongoose.model<Teste>('Teste', testeSchema)
In all the places I left ????? I don't know what to put.
How to do this?
Mongoose has a Date type. (Docs here) Replace the ??? with Date and you should be all set. 
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With