nz-date-picker format datetime is not working in Angular CLI

Dung Do Tien Dec 31 2020 36

I'm working with angular11 and AntDesign Zoro version 11.0. I'm using nz-date-picker control with nzFormat="dd/MM/yyyy" but when I'm using FormBuilder.patchValue to set the date format for this control but it not working.

This is my code:

My response data returned looks like this :

  1. updateTime: "2020-12-30T21:24:20.7403313+07:00"
  2. updateUserId: null
  3. id: 1
Have 1 answer(s) found.
  • I think the problem is here:

    "updateTime": "2020-12-30T21:24:20.7403313+07:00"

    Your service returns the type of moment, but its ant-input is a date data-type. So you need to convert from moment to date.

    try this:

    updateTime: moment(new Date()).format('DD/MM/YYYY'),
    Dũng Đô La Dec 30 2020
Leave An Answer
* NOTE: You need Login before leave an answer

* Type maximum 2000 characters.

* All comments have to wait approved before display.

* Please polite comment and respect questions and answers of others.

Popular Tips