Skip to content

Commit df7d78f

Browse files
committed
Update SQL to SQLite variant; bug fix; Version 0.0.3
1 parent 0a55bcf commit df7d78f

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

modules/config/funcs.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const NOW = {
1010
now: () => new Date(),
1111
},
1212
spelFunc: "new java.util.Date()",
13-
sqlFormatFunc: () => "NOW()",
13+
sqlFormatFunc: () => "date('now')",
1414
mongoFormatFunc: () => new Date(),
1515
formatFunc: () => "NOW",
1616
};
@@ -39,7 +39,7 @@ const RELATIVE_DATETIME = {
3939
},
4040
// MySQL
4141
//todo: other SQL dialects?
42-
sqlFormatFunc: ({date, op, val, dim}) => `DATE_ADD(${date}, INTERVAL ${parseInt(val) * (op == "minus" ? -1 : +1)} ${dim.replace(/^'|'$/g, "")})`,
42+
sqlFormatFunc: ({date, op, val, dim}) => `datetime(${date}, '${parseInt(val) * (op == "'minus'" ? -1 : +1)} ${dim.replace(/^'|'$/g, "")}s')`,
4343
mongoFormatFunc: null, //todo: support?
4444
//todo: spel
4545
formatFunc: ({date, op, val, dim}) => (!val ? date : `${date} ${op == "minus" ? "-" : "+"} ${val} ${dim}`),
@@ -88,8 +88,10 @@ const RELATIVE_DATETIME = {
8888
},
8989
fieldSettings: {
9090
listValues: {
91+
second: "second",
92+
minute: "minute",
93+
hour: "hour",
9194
day: "day",
92-
week: "week",
9395
month: "month",
9496
year: "year",
9597
},

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "comet-awesome-query-builder",
3-
"version": "0.0.2",
3+
"version": "0.0.3",
44
"description": "User-friendly query builder for React. Demo: https://ukrbublik.github.io/react-awesome-query-builder",
55
"keywords": [
66
"query-builder",

0 commit comments

Comments
 (0)