dresende / node-orm2

Object Relational Mapping
http://github.com/dresende/node-orm2
MIT License
3.07k stars 379 forks source link

Timestamp returned is always the same #798

Closed becauseinterwebs closed 6 years ago

becauseinterwebs commented 6 years ago

It seems whenever I retrieve a record that has a Datetime field, the timestamp is always 05:00:00.000.

For example, when I save a record, I have a beforeCreate hook:

this.createdAt = new Date();

This will return (for example):

2017-08-03T00:06:26.396Z

But when I retrieve the record, I get:

2017-08-03T05:00:00.000Z

The time portion of the datetime is always T05:00:00.000.

Is this a setting somewhere?

dxg commented 6 years ago

What does your database table look like?

becauseinterwebs commented 6 years ago

I just realized I did not set time to true:

date: A date object. You can specify time: true

Let me try that!

becauseinterwebs commented 6 years ago

Ok, for some reason I had my datetime fields set to just DATE in the database...oops :/

Sorry about that!