Skip to content

Commit

Permalink
Add additional checks for Date objects. Closes #86.
Browse files Browse the repository at this point in the history
  • Loading branch information
LaughDonor committed Jun 22, 2020
1 parent 13365c9 commit a99b63b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions Document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,9 @@ class Document implements FirestoreAPI.Document, FirestoreAPI.MapValue {
return this.wrapArray(obj);
}

if (obj instanceof Date) {
return this.wrapDate(obj);
// instanceof fails for code referencing this library
if (obj instanceof Date || obj.constructor.name === 'Date') {
return this.wrapDate((obj as any) as Date);
}

// Check if LatLng type
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "firestore_google-apps-script",
"version": "1.0.27",
"version": "1.0.28",
"description": "A Google Apps Script library for accessing Google Cloud Firestore",
"homepage": "https://github.com/grahamearley/FirestoreGoogleAppsScript",
"bugs": "https://github.com/grahamearley/FirestoreGoogleAppsScript/issues",
Expand Down

0 comments on commit a99b63b

Please sign in to comment.