Skip to content

Commit a99b63b

Browse files
committed
Add additional checks for Date objects. Closes #86.
1 parent 13365c9 commit a99b63b

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

Document.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,9 @@ class Document implements FirestoreAPI.Document, FirestoreAPI.MapValue {
137137
return this.wrapArray(obj);
138138
}
139139

140-
if (obj instanceof Date) {
141-
return this.wrapDate(obj);
140+
// instanceof fails for code referencing this library
141+
if (obj instanceof Date || obj.constructor.name === 'Date') {
142+
return this.wrapDate((obj as any) as Date);
142143
}
143144

144145
// Check if LatLng type

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "firestore_google-apps-script",
3-
"version": "1.0.27",
3+
"version": "1.0.28",
44
"description": "A Google Apps Script library for accessing Google Cloud Firestore",
55
"homepage": "https://github.com/grahamearley/FirestoreGoogleAppsScript",
66
"bugs": "https://github.com/grahamearley/FirestoreGoogleAppsScript/issues",

0 commit comments

Comments
 (0)