francescov1 / mongoose-tsgen

A plug-n-play Typescript generator for Mongoose.
102 stars 24 forks source link

Option to replace Date with string (like --no-mongoose replaces ObjectId with string) #149

Closed akshay-nm closed 3 months ago

akshay-nm commented 3 months ago

I am using -no-mongoose flag to generate types used in frontend. But my query responses have dates as string. For example,

type User {
  createdAt: Date
}

But what I get from query response is

type User {
  createdAt: string
}

it'd be nice to have another flag, or some way to configure this.

francescov1 commented 3 months ago

Sorry for the delay @akshay-nm, great suggestion. Just added this feature in v9.3.3 with flag --dates-as-strings 🚀