From d41d7491d42f66fd71819a86e6d73eee71e01203 Mon Sep 17 00:00:00 2001 From: Yuan Gao <930832+meseta@users.noreply.github.com> Date: Sat, 1 Sep 2018 21:11:58 +0100 Subject: [PATCH] rename to google-datastore, and use Date.now() --- .../{googledatastore.js => google-datastore.js} | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) rename lib/document_stores/{googledatastore.js => google-datastore.js} (92%) diff --git a/lib/document_stores/googledatastore.js b/lib/document_stores/google-datastore.js similarity index 92% rename from lib/document_stores/googledatastore.js rename to lib/document_stores/google-datastore.js index d951aec..780780a 100644 --- a/lib/document_stores/googledatastore.js +++ b/lib/document_stores/google-datastore.js @@ -14,8 +14,7 @@ class GoogleDatastoreDocumentStore { // Save file in a key set(key, data, callback, skipExpire) { - var now = new Date(); - var expireTime = (skipExpire || this.expire === undefined) ? null : new Date(now.getTime() + this.expire * 1000); + var expireTime = (skipExpire || this.expire === undefined) ? null : new Date(Date.now() + this.expire * 1000); var taskKey = this.datastore.key([this.kind, key]) var task = { @@ -59,7 +58,6 @@ class GoogleDatastoreDocumentStore { else { // update expiry - var now = new Date(); var task = { key: taskKey, data: [ @@ -70,7 +68,7 @@ class GoogleDatastoreDocumentStore { }, { name: 'expiration', - value: new Date(now.getTime() + this.expire * 1000) + value: new Date(Date.now() + this.expire * 1000) } ] };