Argument of type Moment is not assignable to parameter of type Date

Discussão em 'Angular' iniciado por liumengyang, Outubro 21, 2024.

  1. liumengyang

    liumengyang Guest

    import { Moment } from 'moment';
    import * as moment from 'moment/moment';

    export class JobExecution {
    public startTime: Moment;


    constructor() {
    this.stepExecutions = [];
    }

    public get startTimeFormatted(): string {
    return DateTimeUtils.formatAsDateTime(this.startTime);
    }


    It shows an error saying.


    Argument of type 'Moment' is not assignable to parameter of type 'Date'.

    Property 'toDateString' is missing in type 'Moment'.
    ​

    return DateTimeUtils.formatAsDateTime(this.startTime)


    This code is wrong

    [​IMG]

    [​IMG]

    Continue reading...

Compartilhe esta Página