I'm working with TypeScript and have the following code snippet:
const EmployeeDetailsSchema: mongoose.Schema = new mongoose.Schema({
employeeId: { type: String },
advance: {
lastAdvanceClosedOn: { type: String },
pending: { type: String },
nextVacation: { type: String },
IquamaStatus: { type: String },
allowedAdvance: { type: Number },
duration: { type: String },
requiredAdvance: { type: Number },
adDate: { type: Date, default: new Date(new Date().getFullYear(),new Date().getMonth() , new Date().getDate()) }}
}
);
When I check my database table, the value of adDate looks like this:
adDate : 2020-03-12T00:00:00.000+00:00
My desired output format for adDate is:
adDate : 12-03-2020
Is there a way to achieve this without changing the 'type' to String?