How to use moment.Moment attribut directly in Angular?

Viewed 50

My Angular model contain a Date. Is it possible use directly a moment.Moment Object? I deserialize a REST API with a date (ex: 2019-10-01T11:06:03). If the model contains an attribute of type Date do not work. If the model contains an attribute of type moment.Moment do not work.

For now, I have the following code:

export class Foo {

    public startDate: Date;
}

moment(foo.startDate).locale('fr').format('dddd DD MMMM')

How to use directly a moment.Moment Object?

import * as moment from 'moment';
export class Foo {

    public startDate: moment.Moment;
}

foo.startDate.locale('fr').format('dddd DD MMMM')  <= This do not work (format is not a function)
0 Answers
Related