keystonejs/keystone-classic

Datetime field type adds 5 hours to data

Open

#4,082 创建于 2017年3月9日

在 GitHub 查看
 (9 评论) (0 反应) (0 负责人)JavaScript (14,656 star) (2,288 fork)batch import
help wantedneeds confirmation

描述

Expected behavior

When converting a JavaScript Datetime object to an ISOString and then uploading to a KeystoneJS app, I expect the get the same time string back from the server.

Actual behavior

The Datetime string returned by the server has 5 hours appended to the value.

Steps to reproduce the behavior

  1. I create a model with a Datetime field like so: reportGenerated: { type: Types.Datetime, default: Date.now }

  2. Below is an example of an object with JavaScript Date objects:

Image 1

  1. I use an API, similar to the API Gist by Jed or the File and Image API Guide. That API will reject JavaScript Date objects, but will accept an ISO string. Here is an example of the same object with it's Date objects converted to ISO strings using Date.toISOString() in preparation of uploading to the KeystoneJS server:

Image 2

  1. Send data to the server succeeds. However, when retrieving the same data from the server, the ISO strings have 5 hours added to them:

Image 3

贡献者指南