When working on editing a user profile, the API call returns the following data structure:
export class User {
username: string;
email: string;
creationTime: Date;
birthDate: Date;
}
For validating and manipulating the birthDate value in Angular Material DatePicker, what is the best approach to declare it as a model class field? Should I use native Date type with moment.js for date manipulation, or simply use moment.Moment without using Date at all?
As for the creationTime, if it's just for displaying to the user, should it be declared as a string type in the frontend?
Finally, when converting values to and from strings for backend communication, should the conversion happen in the service call to the API (e.g. using a reviver function), or is it better to handle it within the model constructor?