rename to google-datastore, and use Date.now()

This commit is contained in:
Yuan Gao 2018-09-01 21:11:58 +01:00 committed by GitHub
parent 5fb43eb67c
commit d41d7491d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 4 deletions

View File

@ -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)
}
]
};