Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
276 views
in Technique[技术] by (71.8m points)

javascript - 灌注范围压光机输出问题(Primeng range calender output issue)

I want to format the output of the Primeng Range Calender for both dates to be 'dd/MM/yyyy' like this, and I tried to use pipe to transform the these data.

(我想像这样将两个日期的Primeng Range日历的输出格式设置为“ dd / MM / yyyy”,并且尝试使用管道转换这些数据。)

But is only only transforming the first date, and not the second.

(但是,仅改变第一个日期,而不是第二个。)

Html code is:

(HTML代码是:)

<div>{{rangeDates | date: 'dd/MM/yyyy'}}</div>

Ts file is:

(ts文件是:)

  rangeDates: Date[];

I'm getting this error:

(我收到此错误:)

Error: InvalidPipeArgument: 'Unable to convert "Mon Dec 02 2019 00:00:00 GMT+0100 (Central European Standard Time),Tue Dec 10 2019 00:00:00 GMT+0100 (Central European Standard Time)" into a date' for pipe 'DatePipe'
  ask by Ivana translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Try this

(尝试这个)

<div *ngFor="let range of rangeDates"">
    {{range | date: 'dd/MM/yyyy'}}
</div>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...