Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Date BETWEEN/< and > returns invalid results #127

Closed
neofuture opened this issue Feb 11, 2019 · 2 comments

Comments

Projects
None yet
2 participants
@neofuture
Copy link

commented Feb 11, 2019

Describe the bug
When running a query on a date, invalid rows are returned

Example

nSQL("ContactHistory").query("select").where(["AppDate", ">", "2009-08-06T00:00:00"], "AND", ["AppDate", "<", "2009-08-07T00:00:00"]).exec().then((row) => {
    // row selected
    console.log(row);
}, () => {
    // query complete
}, (error) => {
    // query error
});

returns

[
    {
        "EQBVID": 4426,
        "AppDate": "2009-09-28T00:00:00"
    },
    {
        "EQBVID": 4424,
        "AppDate": "2009-09-20T00:00:00"
    },
    {
        "EQBVID": 4409,
        "AppDate": "2009-08-08T00:00:00"
    },
    {
        "EQBVID": 4408,
        "AppDate": "2009-08-20T00:00:00"
    },
    {
        "EQBVID": 4407,
        "AppDate": "2009-08-21T00:00:00"
    },
    {
        "EQBVID": 15347,
        "AppDate": "2009-08-08T00:00:00"
    },
    {
        "EQBVID": 4381,
        "AppDate": "2009-08-07T00:00:00"
    },
    {
        "EQBVID": 4380,
        "AppDate": "2009-08-10T00:00:00"
    },
    {
        "EQBVID": 4379,
        "AppDate": "2009-08-11T00:00:00"
    },
    {
        "EQBVID": 4378,
        "AppDate": "2009-08-12T00:00:00"
    },
    {
        "EQBVID": 4377,
        "AppDate": "2009-08-13T00:00:00"
    },
    {
        "EQBVID": 4376,
        "AppDate": "2009-08-14T00:00:00"
    },
    {
        "EQBVID": 4337,
        "AppDate": "2009-11-08T00:00:00"
    },
    {
        "EQBVID": 4333,
        "AppDate": "2009-08-08T00:00:00"
    },
    {
        "EQBVID": 4332,
        "AppDate": "2009-08-14T00:00:00"
    },
    {
        "EQBVID": 4331,
        "AppDate": "2009-08-15T00:00:00"
    },
    {
        "EQBVID": 4330,
        "AppDate": "2009-08-17T00:00:00"
    },
    {
        "EQBVID": 4329,
        "AppDate": "2009-09-07T00:00:00"
    },
    {
        "EQBVID": 4328,
        "AppDate": "2009-09-08T00:00:00"
    },
    {
        "EQBVID": 4327,
        "AppDate": "2009-09-09T00:00:00"
    },
    {
        "EQBVID": 4326,
        "AppDate": "2009-09-10T00:00:00"
    },
    {
        "EQBVID": 4325,
        "AppDate": "2009-09-11T00:00:00"
    },
    {
        "EQBVID": 4324,
        "AppDate": "2009-09-12T00:00:00"
    },
    {
        "EQBVID": 4321,
        "AppDate": "2009-09-15T00:00:00"
    },
    {
        "EQBVID": 4320,
        "AppDate": "2009-09-16T00:00:00"
    },
    {
        "EQBVID": 4319,
        "AppDate": "2009-09-17T00:00:00"
    },
    {
        "EQBVID": 4318,
        "AppDate": "2009-09-18T00:00:00"
    },
    {
        "EQBVID": 4317,
        "AppDate": "2009-09-19T00:00:00"
    },
    {
        "EQBVID": 4316,
        "AppDate": "2009-09-20T00:00:00"
    },
    {
        "EQBVID": 4311,
        "AppDate": "2009-08-08T00:00:00"
    },
    {
        "EQBVID": 4310,
        "AppDate": "2009-08-15T00:00:00"
    },
    {
        "EQBVID": 4308,
        "AppDate": "2009-08-31T00:00:00"
    },
    {
        "EQBVID": 15308,
        "AppDate": "2009-08-14T00:00:00"
    },
    {
        "EQBVID": 15307,
        "AppDate": "2009-08-19T00:00:00"
    },
    {
        "EQBVID": 15306,
        "AppDate": "2009-08-22T00:00:00"
    },
    {
        "EQBVID": 15305,
        "AppDate": "2009-08-23T00:00:00"
    },
    {
        "EQBVID": 15304,
        "AppDate": "2009-08-27T00:00:00"
    },
    {
        "EQBVID": 4305,
        "AppDate": "2009-08-15T00:00:00"
    },
    {
        "EQBVID": 4304,
        "AppDate": "2009-08-17T00:00:00"
    },
    {
        "EQBVID": 4303,
        "AppDate": "2009-08-18T00:00:00"
    },
    {
        "EQBVID": 4302,
        "AppDate": "2009-08-20T00:00:00"
    },
    {
        "EQBVID": 4301,
        "AppDate": "2009-08-21T00:00:00"
    },
    {
        "EQBVID": 4300,
        "AppDate": "2009-08-22T00:00:00"
    },
    {
        "EQBVID": 4299,
        "AppDate": "2009-08-23T00:00:00"
    },
    {
        "EQBVID": 4298,
        "AppDate": "2009-08-07T00:00:00"
    },
    {
        "EQBVID": 4297,
        "AppDate": "2009-08-08T00:00:00"
    },
    {
        "EQBVID": 4296,
        "AppDate": "2009-08-09T00:00:00"
    },
    {
        "EQBVID": 15282,
        "AppDate": "2009-08-07T00:00:00"
    },
    {
        "EQBVID": 15280,
        "AppDate": "2009-08-17T00:00:00"
    },
    {
        "EQBVID": 15279,
        "AppDate": "2009-08-18T00:00:00"
    },
    {
        "EQBVID": 15278,
        "AppDate": "2009-08-07T00:00:00"
    },
    {
        "EQBVID": 15276,
        "AppDate": "2009-08-17T00:00:00"
    },
    {
        "EQBVID": 15275,
        "AppDate": "2009-08-17T00:00:00"
    },
    {
        "EQBVID": 15274,
        "AppDate": "2009-08-17T00:00:00"
    },
    {
        "EQBVID": 15273,
        "AppDate": "2009-09-11T00:00:00"
    },
    {
        "EQBVID": 15272,
        "AppDate": "2009-09-11T00:00:00"
    },
    {
        "EQBVID": 15271,
        "AppDate": "2009-09-11T00:00:00"
    },
    {
        "EQBVID": 15270,
        "AppDate": "2009-09-11T00:00:00"
    },
    {
        "EQBVID": 15269,
        "AppDate": "2009-09-11T00:00:00"
    },
    {
        "EQBVID": 15268,
        "AppDate": "2009-09-11T00:00:00"
    },
    {
        "EQBVID": 4295,
        "AppDate": "2009-09-10T00:00:00"
    },
    {
        "EQBVID": 4294,
        "AppDate": "2009-09-11T00:00:00"
    },
    {
        "EQBVID": 4293,
        "AppDate": "2009-09-12T00:00:00"
    },
    {
        "EQBVID": 4292,
        "AppDate": "2009-08-28T00:00:00"
    },
    {
        "EQBVID": 4291,
        "AppDate": "2009-08-29T00:00:00"
    },
    {
        "EQBVID": 15267,
        "AppDate": "2009-08-12T00:00:00"
    },
    {
        "EQBVID": 15266,
        "AppDate": "2009-08-12T00:00:00"
    },
    {
        "EQBVID": 15265,
        "AppDate": "2009-08-19T00:00:00"
    },
    {
        "EQBVID": 15264,
        "AppDate": "2009-08-19T00:00:00"
    },
    {
        "EQBVID": 15263,
        "AppDate": "2009-08-16T00:00:00"
    },
    {
        "EQBVID": 15262,
        "AppDate": "2009-09-01T00:00:00"
    },
    {
        "EQBVID": 15261,
        "AppDate": "2009-09-05T00:00:00"
    },
    {
        "EQBVID": 15260,
        "AppDate": "2009-09-11T00:00:00"
    },
    {
        "EQBVID": 15259,
        "AppDate": "2009-09-15T00:00:00"
    },
    {
        "EQBVID": 15258,
        "AppDate": "2009-09-28T00:00:00"
    },
    {
        "EQBVID": 15257,
        "AppDate": "2009-08-21T00:00:00"
    },
    {
        "EQBVID": 15256,
        "AppDate": "2009-08-18T00:00:00"
    },
    {
        "EQBVID": 15255,
        "AppDate": "2009-08-18T00:00:00"
    },
    {
        "EQBVID": 15254,
        "AppDate": "2009-08-18T00:00:00"
    },
    {
        "EQBVID": 15253,
        "AppDate": "2009-08-18T00:00:00"
    },
    {
        "EQBVID": 15252,
        "AppDate": "2009-08-18T00:00:00"
    },
    {
        "EQBVID": 15251,
        "AppDate": "2009-08-30T00:00:00"
    },
    {
        "EQBVID": 15250,
        "AppDate": "2009-08-19T00:00:00"
    },
    {
        "EQBVID": 15249,
        "AppDate": "2009-08-20T00:00:00"
    },
    {
        "EQBVID": 15248,
        "AppDate": "2009-08-20T00:00:00"
    },
    {
        "EQBVID": 15247,
        "AppDate": "2009-08-20T00:00:00"
    },
    {
        "EQBVID": 15246,
        "AppDate": "2009-08-20T00:00:00"
    },
    {
        "EQBVID": 15245,
        "AppDate": "2009-08-20T00:00:00"
    },
    {
        "EQBVID": 15244,
        "AppDate": "2009-08-20T00:00:00"
    },
    {
        "EQBVID": 15243,
        "AppDate": "2009-08-22T00:00:00"
    },
    {
        "EQBVID": 15242,
        "AppDate": "2009-08-22T00:00:00"
    },
    {
        "EQBVID": 15241,
        "AppDate": "2009-08-21T00:00:00"
    },
    {
        "EQBVID": 15240,
        "AppDate": "2009-09-03T00:00:00"
    },
    {
        "EQBVID": 15239,
        "AppDate": "2009-09-03T00:00:00"
    },
    {
        "EQBVID": 15238,
        "AppDate": "2009-09-03T00:00:00"
    },
    {
        "EQBVID": 15237,
        "AppDate": "2009-09-03T00:00:00"
    },
    {
        "EQBVID": 15236,
        "AppDate": "2009-09-03T00:00:00"
    },
    {
        "EQBVID": 15235,
        "AppDate": "2009-09-03T00:00:00"
    },
    {
        "EQBVID": 15234,
        "AppDate": "2009-09-03T00:00:00"
    },
    {
        "EQBVID": 15233,
        "AppDate": "2009-09-03T00:00:00"
    },
    {
        "EQBVID": 15232,
        "AppDate": "2009-09-03T00:00:00"
    },
    {
        "EQBVID": 15231,
        "AppDate": "2009-09-03T00:00:00"
    },
    {
        "EQBVID": 15230,
        "AppDate": "2009-09-03T00:00:00"
    },
    {
        "EQBVID": 15229,
        "AppDate": "2009-09-03T00:00:00"
    },
    {
        "EQBVID": 15228,
        "AppDate": "2009-09-05T00:00:00"
    },
    {
        "EQBVID": 15227,
        "AppDate": "2009-09-06T00:00:00"
    },
    {
        "EQBVID": 15226,
        "AppDate": "2009-09-05T00:00:00"
    },
    {
        "EQBVID": 15225,
        "AppDate": "2009-08-29T00:00:00"
    },
    {
        "EQBVID": 15224,
        "AppDate": "2009-09-03T00:00:00"
    },
    {
        "EQBVID": 15223,
        "AppDate": "2009-09-03T00:00:00"
    },
    {
        "EQBVID": 15222,
        "AppDate": "2009-09-03T00:00:00"
    }
]
@ClickSimply

This comment has been minimized.

Copy link
Owner

commented Feb 11, 2019

There isn't any support for date types right now, so AppDate in this case would be treated like any other string.

It looks like it wouldn't be very difficult to add though, I'll put this in the next release.

@ClickSimply

This comment has been minimized.

Copy link
Owner

commented Feb 13, 2019

There's a new date data type in 2.1.9 You'll need to adjust the type in your data model to date, then reinsert all your records (at least the dates), then it should work as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.