Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个来自 API 31-08-2021 13:58格式的日期 我想在一个 mat-cell 中显示这个日期,然后在另一个单元格中我必须添加 7 例如:7-09-2021 13:58并展示如何实现这一点。
您可以在 ts 文件中执行类似的操作。
date = new Date(); nextDate = new Date(); ngOnInit() { this.nextDate.setDate(this.date.getDate() + 7); }
date - 当前日期(可以是 API 响应中的日期)
nextDate - 日期 + 7 即下一个第 7 天。