balderdashy / balderdashy/sails

Model.find() waterline query auto adjusting date time and returning with Timezone format.

Open
#4,607 6 comments 0 reactions 0 assignees View on GitHub
helpful info or workaround orm
Dominant language
JavaScript
Stars
22.8k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

**Waterline version**: 0.13.6
**Node version**: 9.11.2
**NPM version**: 6.7.0
**Operating system**: Ubuntu 18.04.1 LTS


I'm storing a Date variable as
{ type:'ref', columntype:'date' }
column in mySQL table.

Here's the problem now: When I insert the date, eg: 2019-02-15, I'm able to store it without any problem. But when I try to fetch the data through Model.find()
I'm getting results with TimeZone (UTC adjusted) format like: 2019-02-14T18:30:00.000Z

The waterline query somehow adjusts for the Timezone and reduce 05:30 Hrs from the time on server.

How can I fetch the date as it is on server?

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the behavior through Waterline's Model.find() against the MySQL date column using the versions and Ubuntu environment listed in the issue. Trace the date handling from the query result to the returned model value; done means the stored date is returned without the reported unwanted timezone adjustment, with the behavior verified against the reproduction case.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, mysql, node.js
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.