본문 바로가기

카테고리 없음

[Firebase] firestore timestamps 변경 경고 관련

728x90
index.esm.js:77 [2018-05-02T05:45:40.408Z]  @firebase/firestore: 
 Firestore (4.13.0): 
 The behavior for Date objects stored in Firestore is going to change
 AND YOUR APP MAY BREAK.
 To hide this warning and ensure your app does not break, you need to 
 add the
 following code to your app before calling any other Cloud Firestore 
 methods:

 const firestore = firebase.firestore();
 const settings = {/* your settings... */ timestampsInSnapshots: 
 true};
 firestore.settings(settings);

 With this change, timestamps stored in Cloud Firestore will be read 
 back as
 Firebase Timestamp objects instead of as system Date objects. So you 
 will also
 need to update code expecting a Date to instead expect a Timestamp. 
 For example:

 // Old:
 const date = snapshot.get('created_at');
 // New:
 const timestamp = snapshot.get('created_at');
 const date = timestamp.toDate();

 Please audit all existing usages of Date when you enable the new 
 behavior. In a
 future release, the behavior will change to the new behavior, so if 
 you do not
 follow these steps, YOUR APP MAY BREAK.

파이어베이스의 파이어스토어를 사용하다 보면

시간 설정 관련해서 에러 메시지를 만나게 된다.


침착하게 설정값을 넣어주면 해결된다.


firebase.firestore().settings({
timestampsInSnapshots: true
})



잘가~ 경고창아~ 

자주 보지 말자~

가우넷 구름 USB 충전식 양면 대용량 보조배터리 손난로, 단일 상품, 화이트



"파트너스 활동을 통해 일정액의 수수료를 제공받을 수 있음"