Guest User

Untitled

a guest
Oct 22nd, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. //When creating an object
  2. const timestamp = new Date();
  3. const createdAt = timestamp;
  4. const updatedAt = timestamp;
  5.  
  6. //The date is stored as follows:
  7. createdAt: October 23,2018 at 12:30:23 AM UTC+5:30
  8.  
  9. //when fetched, the date is received as follows:
  10. e{nanoseconds: 365000000, seconds: 1539876053}
  11.  
  12. //To manipulate date,do the following when fetching
  13. createdAt = createdAt.toDate()
  14.  
  15. //to update the date after fetching
  16. createdAt = new Date(createdAt)
  17.  
  18. //Then the date is stored as mentioned above.
Add Comment
Please, Sign In to add comment