NgxTimestampDate
NgxTimestampDate is a simple @angular/fire tool provided by Anchor Solutions to convert timestamps in retrieved documents from firestore database back to JS Date object. It recursively parse the object document presented to located timestamp values and then convert them to JS Date normally.
Installation
Install ngx-timestamp-date via npm by running the following command:
npm install ngx-timestamp-date --save
Usage
Register the NgxTimestampDateModule
in your app module (or any other module you want to use it).
;
NgxTimestampDateService
service from anywhere in your app like below:
Use
Methods
Method Name | Params | Return type | Description |
---|---|---|---|
timestampToDate | Timestamp | Date | Converts timestamp object to date object |
dateToTimestamp | Date | Timestamp | Converts JS date object to timestamp |
parseTimestampToDate | Recursively iterates through properties of a JS object and convert all occurences of timestamp to normal JS Date |
Further Reading
Have a look at other packages by Anchor Solutions: