【发布时间】:2020-02-23 16:54:15
【问题描述】:
我有一项从 BehaviorSubject 获取某些数据的服务。
this.myData.album$.value.album_date;
当控制台记录从firestore返回的日期时:
console.log(this.myData.album$.value.album_date);
控制台显示:
Timestamp {seconds: 1572263054, nanoseconds: 63000000}
我需要做的是在我的一个函数中将此值转换为任何格式,例如“2019 年 10 月 28 日,星期一”。
不幸的是,鉴于我的要求,我不能在 HTML 中使用 toDate() |,这需要在我的函数中实现。
我们将不胜感激。
注意:我有 moment 可以在我的 Typescript 文件中使用。
我正在使用Angular 8 和Firestore
【问题讨论】:
标签: typescript date google-cloud-firestore momentjs