Skip to content

Commit

Permalink
v.1.0.3: Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
olegkorol committed Nov 29, 2024
1 parent dde5bbb commit 96d7696
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
20 changes: 8 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,20 +169,16 @@ Returns the updated document with an additional `_id` and `_path` fields.

## Using timestamps

Firestore timestamps are not implemented in this library. If you need to use
timestamps, here's how you can do it:

```bash
deno add npm:firebase/firestore
```

...and then use the `Timestamp` class from the `firebase/firestore` package:
If you need to use Firestore timestamps, simply use `Date` objects, e.g.:

```typescript
import { Timestamp } from "npm:firebase/firestore";
const now = new Date();

// e.g.
const timestamp = Timestamp.now();
// ...and then use it in your document:

await firestore.createDocument("my-collection", {
createdAt: now,
});
```

> Note: The same principle applies to `UnionArray` field operations, etc.
The above will be converted to a Firestore timestamp automatically.
2 changes: 1 addition & 1 deletion deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@koiztech/firestore-admin",
"version": "1.0.2",
"version": "1.0.3",
"exports": "./mod.ts",
"tasks": {
"dev": "deno run --watch --env mod.ts",
Expand Down

0 comments on commit 96d7696

Please sign in to comment.