# firestore-timestamp-formatter

> Firestore Timestamp Formatter

Latest version **1.0.4** (published 2021-08-10) · ISC license · 0 weekly downloads

## Install

```sh
npm install firestore-timestamp-formatter
pnpm add firestore-timestamp-formatter
yarn add firestore-timestamp-formatter
bun add firestore-timestamp-formatter
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2021-08-10 |
| First published | 2021-06-24 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 2.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Abdulrasaq Nasirudeen |
| Maintainers | nosisky |
| Keywords | firestore, timestamp, formatter, firebase |

## Links

- npm: https://www.npmjs.com/package/firestore-timestamp-formatter
- Repository: https://github.com/nosisky/firestore-timestamp-formatter
- Homepage: https://github.com/nosisky/firestore-timestamp-formatter#readme
- Issues: https://github.com/nosisky/firestore-timestamp-formatter/issues
- npm.io page: https://npm.io/package/firestore-timestamp-formatter

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.4 (latest) — 2021-08-10
- 1.0.3 — 2021-07-05
- 1.0.2 — 2021-06-24
- 1.0.1 — 2021-06-24
- 1.0.0 — 2021-06-24

## README

# firestore-timestamp-converter

[![NPM version](https://badge.fury.io/js/firestore-timestamp-formatter.svg)](https://npmjs.org/package/firestore-timestamp-formatter)

> Firestore WithConverter method to auto convert from default firestore timestamp to javascript date object

## Description

While working on a firestore project, I figured I needed to manually convert the firestore timestamp response to actual javascript date object before they become usable, the problem with this is that even if I have an array of data, I need to always loop through and manually convert to javascript date object using the `toDate` method. This can be time-consuming.

## How To Use

```js
import TimestampConverter from 'firestore-timestamp-formatter';

const response = await db
  .collection("user")
  .doc(id)
  .withConverter(TimestampConverter))
  .get();

The `response` will now contain a valid javascript date object instead of the default firestore timestamp.
```

## Installation

Use your favourite package manager to add the package to your package.json

```sh
npm i firestore-timestamp-formatter
```

---
_Source: https://npm.io/package/firestore-timestamp-formatter · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
