@react-querybuilder/datetime 8.8.3 → 8.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/getDatetimeRuleProcessorSQL-npwUe9aM.js +2 -0
- package/dist/cjs/getDatetimeRuleProcessorSQL-npwUe9aM.js.map +1 -0
- package/dist/cjs/react-querybuilder_datetime.cjs.development.date-fns.js +81 -775
- package/dist/cjs/react-querybuilder_datetime.cjs.development.date-fns.js.map +1 -1
- package/dist/cjs/react-querybuilder_datetime.cjs.development.dayjs.js +75 -785
- package/dist/cjs/react-querybuilder_datetime.cjs.development.dayjs.js.map +1 -1
- package/dist/cjs/react-querybuilder_datetime.cjs.development.js +124 -934
- package/dist/cjs/react-querybuilder_datetime.cjs.development.js.map +1 -1
- package/dist/cjs/react-querybuilder_datetime.cjs.development.jsdate.js +113 -834
- package/dist/cjs/react-querybuilder_datetime.cjs.development.jsdate.js.map +1 -1
- package/dist/cjs/react-querybuilder_datetime.cjs.development.luxon.js +77 -779
- package/dist/cjs/react-querybuilder_datetime.cjs.development.luxon.js.map +1 -1
- package/dist/cjs/react-querybuilder_datetime.cjs.production.date-fns.js +1 -6
- package/dist/cjs/react-querybuilder_datetime.cjs.production.date-fns.js.map +1 -1
- package/dist/cjs/react-querybuilder_datetime.cjs.production.dayjs.js +1 -6
- package/dist/cjs/react-querybuilder_datetime.cjs.production.dayjs.js.map +1 -1
- package/dist/cjs/react-querybuilder_datetime.cjs.production.js +1 -7
- package/dist/cjs/react-querybuilder_datetime.cjs.production.js.map +1 -1
- package/dist/cjs/react-querybuilder_datetime.cjs.production.jsdate.js +1 -7
- package/dist/cjs/react-querybuilder_datetime.cjs.production.jsdate.js.map +1 -1
- package/dist/cjs/react-querybuilder_datetime.cjs.production.luxon.js +1 -6
- package/dist/cjs/react-querybuilder_datetime.cjs.production.luxon.js.map +1 -1
- package/dist/getDatetimeRuleProcessorSQL-CocyaiI5.mjs +373 -0
- package/dist/getDatetimeRuleProcessorSQL-CocyaiI5.mjs.map +1 -0
- package/dist/getDatetimeRuleProcessorSQL-CutYTD23.js +392 -0
- package/dist/getDatetimeRuleProcessorSQL-CutYTD23.js.map +1 -0
- package/dist/react-querybuilder_datetime.date-fns.mjs +72 -57
- package/dist/react-querybuilder_datetime.date-fns.mjs.map +1 -1
- package/dist/react-querybuilder_datetime.dayjs.mjs +66 -57
- package/dist/react-querybuilder_datetime.dayjs.mjs.map +1 -1
- package/dist/react-querybuilder_datetime.jsdate.mjs +102 -114
- package/dist/react-querybuilder_datetime.jsdate.mjs.map +1 -1
- package/dist/react-querybuilder_datetime.legacy-esm.date-fns.js +72 -57
- package/dist/react-querybuilder_datetime.legacy-esm.date-fns.js.map +1 -1
- package/dist/react-querybuilder_datetime.legacy-esm.dayjs.js +66 -57
- package/dist/react-querybuilder_datetime.legacy-esm.dayjs.js.map +1 -1
- package/dist/react-querybuilder_datetime.legacy-esm.js +113 -215
- package/dist/react-querybuilder_datetime.legacy-esm.js.map +1 -1
- package/dist/react-querybuilder_datetime.legacy-esm.jsdate.js +102 -114
- package/dist/react-querybuilder_datetime.legacy-esm.jsdate.js.map +1 -1
- package/dist/react-querybuilder_datetime.legacy-esm.luxon.js +68 -61
- package/dist/react-querybuilder_datetime.legacy-esm.luxon.js.map +1 -1
- package/dist/react-querybuilder_datetime.luxon.mjs +68 -61
- package/dist/react-querybuilder_datetime.luxon.mjs.map +1 -1
- package/dist/react-querybuilder_datetime.mjs +112 -215
- package/dist/react-querybuilder_datetime.mjs.map +1 -1
- package/dist/react-querybuilder_datetime.production.date-fns.mjs +1 -1
- package/dist/react-querybuilder_datetime.production.date-fns.mjs.map +1 -1
- package/dist/react-querybuilder_datetime.production.dayjs.mjs +1 -1
- package/dist/react-querybuilder_datetime.production.dayjs.mjs.map +1 -1
- package/dist/react-querybuilder_datetime.production.jsdate.mjs +1 -2
- package/dist/react-querybuilder_datetime.production.jsdate.mjs.map +1 -1
- package/dist/react-querybuilder_datetime.production.luxon.mjs +1 -1
- package/dist/react-querybuilder_datetime.production.luxon.mjs.map +1 -1
- package/dist/react-querybuilder_datetime.production.mjs +1 -2
- package/dist/react-querybuilder_datetime.production.mjs.map +1 -1
- package/package.json +10 -10
- package/dist/chunk-SLTJVKUE.mjs +0 -7
- package/dist/chunk-SLTJVKUE.mjs.map +0 -1
- package/dist/chunk-ZLH5EH6W.mjs +0 -713
- package/dist/chunk-ZLH5EH6W.mjs.map +0 -1
- package/dist/chunk-ZS6AX35I.js +0 -738
- package/dist/chunk-ZS6AX35I.js.map +0 -1
|
@@ -1,61 +1,70 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getDatetimeJsonLogicOperations,
|
|
3
|
-
getDatetimeRuleProcessorCEL,
|
|
4
|
-
getDatetimeRuleProcessorMongoDBQuery,
|
|
5
|
-
getDatetimeRuleProcessorNL,
|
|
6
|
-
getDatetimeRuleProcessorSQL,
|
|
7
|
-
getDatetimeValueProcessorANSI,
|
|
8
|
-
getDatetimeValueProcessorMSSQL,
|
|
9
|
-
getDatetimeValueProcessorMySQL,
|
|
10
|
-
getDatetimeValueProcessorOracle,
|
|
11
|
-
getDatetimeValueProcessorPostgreSQL,
|
|
12
|
-
isISOStringDateOnly
|
|
13
|
-
} from "./chunk-ZLH5EH6W.mjs";
|
|
14
|
-
|
|
15
|
-
// src/rqbDateTimeLibraryAPI.dayjs.ts
|
|
1
|
+
import { getDatetimeJsonLogicOperations, getDatetimeRuleProcessorCEL, getDatetimeRuleProcessorMongoDBQuery, getDatetimeRuleProcessorNL, getDatetimeRuleProcessorSQL, getDatetimeValueProcessorANSI, getDatetimeValueProcessorMSSQL, getDatetimeValueProcessorMySQL, getDatetimeValueProcessorOracle, getDatetimeValueProcessorPostgreSQL, isISOStringDateOnly } from "./getDatetimeRuleProcessorSQL-CocyaiI5.mjs";
|
|
16
2
|
import dayjs from "dayjs";
|
|
17
|
-
var rqbDateTimeLibraryAPI = { format: function format(d, fmt) {
|
|
18
|
-
return dayjs(d).format(fmt);
|
|
19
|
-
}, isAfter: function isAfter(a, b) {
|
|
20
|
-
return dayjs(a).isAfter(b);
|
|
21
|
-
}, isBefore: function isBefore(a, b) {
|
|
22
|
-
return dayjs(a).isBefore(b);
|
|
23
|
-
}, isSame: function isSame(a, b) {
|
|
24
|
-
return dayjs(a).isSame(b, isISOStringDateOnly(a) || isISOStringDateOnly(b) ? "d" : "ms");
|
|
25
|
-
}, isValid: function isValid(d) {
|
|
26
|
-
return dayjs(d).isValid();
|
|
27
|
-
}, toDate: function toDate(d) {
|
|
28
|
-
return dayjs(d).toDate();
|
|
29
|
-
}, toISOString: function toISOString(d) {
|
|
30
|
-
var dToDate = dayjs(d);
|
|
31
|
-
return dToDate.isValid() ? dToDate.toISOString() : "";
|
|
32
|
-
}, toISOStringDateOnly: function toISOStringDateOnly(d) {
|
|
33
|
-
var dToDate = dayjs(d);
|
|
34
|
-
return dToDate.isValid() ? dToDate.format("YYYY-MM-DD") : "";
|
|
35
|
-
} };
|
|
36
3
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
datetimeValueProcessorOracle,
|
|
57
|
-
datetimeValueProcessorPostgreSQL,
|
|
58
|
-
jsonLogicDateTimeOperations,
|
|
59
|
-
rqbDateTimeLibraryAPI
|
|
4
|
+
//#region src/rqbDateTimeLibraryAPI.dayjs.ts
|
|
5
|
+
/**
|
|
6
|
+
* {@link RQBDateTimeLibraryAPI} for Day.js
|
|
7
|
+
*/
|
|
8
|
+
const rqbDateTimeLibraryAPI = {
|
|
9
|
+
format: (d, fmt) => dayjs(d).format(fmt),
|
|
10
|
+
isAfter: (a, b) => dayjs(a).isAfter(b),
|
|
11
|
+
isBefore: (a, b) => dayjs(a).isBefore(b),
|
|
12
|
+
isSame: (a, b) => dayjs(a).isSame(b, isISOStringDateOnly(a) || isISOStringDateOnly(b) ? "d" : "ms"),
|
|
13
|
+
isValid: (d) => dayjs(d).isValid(),
|
|
14
|
+
toDate: (d) => dayjs(d).toDate(),
|
|
15
|
+
toISOString: (d) => {
|
|
16
|
+
const dToDate = dayjs(d);
|
|
17
|
+
return dToDate.isValid() ? dToDate.toISOString() : "";
|
|
18
|
+
},
|
|
19
|
+
toISOStringDateOnly: (d) => {
|
|
20
|
+
const dToDate = dayjs(d);
|
|
21
|
+
return dToDate.isValid() ? dToDate.format("YYYY-MM-DD") : "";
|
|
22
|
+
}
|
|
60
23
|
};
|
|
24
|
+
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region src/index.dayjs.ts
|
|
27
|
+
/**
|
|
28
|
+
* Custom JsonLogic date/time operations using Day.js
|
|
29
|
+
*/
|
|
30
|
+
const jsonLogicDateTimeOperations = getDatetimeJsonLogicOperations(rqbDateTimeLibraryAPI);
|
|
31
|
+
/**
|
|
32
|
+
* {@link react-querybuilder!index.formatQuery formatQuery} rule processor for "sql" format using Day.js
|
|
33
|
+
*/
|
|
34
|
+
const datetimeRuleProcessorSQL = getDatetimeRuleProcessorSQL(rqbDateTimeLibraryAPI);
|
|
35
|
+
/**
|
|
36
|
+
* {@link react-querybuilder!index.formatQuery formatQuery} value processor for "sql" format ("ansi" preset) using Day.js
|
|
37
|
+
*/
|
|
38
|
+
const datetimeValueProcessorANSI = getDatetimeValueProcessorANSI(rqbDateTimeLibraryAPI);
|
|
39
|
+
/**
|
|
40
|
+
* {@link react-querybuilder!index.formatQuery formatQuery} value processor for "sql" format ("mssql" preset) using Day.js
|
|
41
|
+
*/
|
|
42
|
+
const datetimeValueProcessorMSSQL = getDatetimeValueProcessorMSSQL(rqbDateTimeLibraryAPI);
|
|
43
|
+
/**
|
|
44
|
+
* {@link react-querybuilder!index.formatQuery formatQuery} value processor for "sql" format ("mysql" preset) using Day.js
|
|
45
|
+
*/
|
|
46
|
+
const datetimeValueProcessorMySQL = getDatetimeValueProcessorMySQL(rqbDateTimeLibraryAPI);
|
|
47
|
+
/**
|
|
48
|
+
* {@link react-querybuilder!index.formatQuery formatQuery} value processor for "sql" format ("oracle" preset) using Day.js
|
|
49
|
+
*/
|
|
50
|
+
const datetimeValueProcessorOracle = getDatetimeValueProcessorOracle(rqbDateTimeLibraryAPI);
|
|
51
|
+
/**
|
|
52
|
+
* {@link react-querybuilder!index.formatQuery formatQuery} value processor for "sql" format ("postgresql" preset) using Day.js
|
|
53
|
+
*/
|
|
54
|
+
const datetimeValueProcessorPostgreSQL = getDatetimeValueProcessorPostgreSQL(rqbDateTimeLibraryAPI);
|
|
55
|
+
/**
|
|
56
|
+
* {@link react-querybuilder!index.formatQuery formatQuery} rule processor for "cel" format using Day.js
|
|
57
|
+
*/
|
|
58
|
+
const datetimeRuleProcessorCEL = getDatetimeRuleProcessorCEL(rqbDateTimeLibraryAPI);
|
|
59
|
+
/**
|
|
60
|
+
* {@link react-querybuilder!index.formatQuery formatQuery} rule processor for "mongodb_query" format using Day.js
|
|
61
|
+
*/
|
|
62
|
+
const datetimeRuleProcessorMongoDBQuery = getDatetimeRuleProcessorMongoDBQuery(rqbDateTimeLibraryAPI);
|
|
63
|
+
/**
|
|
64
|
+
* {@link react-querybuilder!index.formatQuery formatQuery} rule processor for "natural_language" format using Day.js
|
|
65
|
+
*/
|
|
66
|
+
const datetimeRuleProcessorNL = getDatetimeRuleProcessorNL(rqbDateTimeLibraryAPI);
|
|
67
|
+
|
|
68
|
+
//#endregion
|
|
69
|
+
export { datetimeRuleProcessorCEL, datetimeRuleProcessorMongoDBQuery, datetimeRuleProcessorNL, datetimeRuleProcessorSQL, datetimeValueProcessorANSI, datetimeValueProcessorMSSQL, datetimeValueProcessorMySQL, datetimeValueProcessorOracle, datetimeValueProcessorPostgreSQL, jsonLogicDateTimeOperations, rqbDateTimeLibraryAPI };
|
|
61
70
|
//# sourceMappingURL=react-querybuilder_datetime.dayjs.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/rqbDateTimeLibraryAPI.dayjs.ts","../src/index.dayjs.ts"],"sourcesContent":["import dayjs from
|
|
1
|
+
{"version":3,"file":"react-querybuilder_datetime.dayjs.mjs","names":["rqbDateTimeLibraryAPI: RQBDateTimeLibraryAPI","jsonLogicDateTimeOperations: RQBJsonLogicDateTimeOperations","datetimeRuleProcessorSQL: RuleProcessor","datetimeValueProcessorANSI: ValueProcessorByRule","datetimeValueProcessorMSSQL: ValueProcessorByRule","datetimeValueProcessorMySQL: ValueProcessorByRule","datetimeValueProcessorOracle: ValueProcessorByRule","datetimeValueProcessorPostgreSQL: ValueProcessorByRule","datetimeRuleProcessorCEL: ValueProcessorByRule","datetimeRuleProcessorMongoDBQuery: ValueProcessorByRule","datetimeRuleProcessorNL: ValueProcessorByRule"],"sources":["../src/rqbDateTimeLibraryAPI.dayjs.ts","../src/index.dayjs.ts"],"sourcesContent":["import dayjs from 'dayjs';\nimport type { RQBDateTimeLibraryAPI } from './types';\nimport { isISOStringDateOnly } from './utils';\n\n/**\n * {@link RQBDateTimeLibraryAPI} for Day.js\n */\nexport const rqbDateTimeLibraryAPI: RQBDateTimeLibraryAPI = {\n format: (d, fmt) => dayjs(d).format(fmt),\n isAfter: (a, b) => dayjs(a).isAfter(b),\n isBefore: (a, b) => dayjs(a).isBefore(b),\n isSame: (a, b) =>\n dayjs(a).isSame(b, isISOStringDateOnly(a) || isISOStringDateOnly(b) ? 'd' : 'ms'),\n isValid: d => dayjs(d).isValid(),\n toDate: d => dayjs(d).toDate(),\n toISOString: d => {\n const dToDate = dayjs(d);\n return dToDate.isValid() ? dToDate.toISOString() : '';\n },\n toISOStringDateOnly: d => {\n const dToDate = dayjs(d);\n return dToDate.isValid() ? dToDate.format('YYYY-MM-DD') : '';\n },\n};\n","/**\n * Import from `\"@react-querybuilder/datetime/dayjs\"` for enhanced date/time support using [Day.js](https://day.js.org/).\n *\n * @module dayjs\n */\n\nimport type { RuleProcessor, ValueProcessorByRule } from 'react-querybuilder';\nimport { getDatetimeJsonLogicOperations } from './getDatetimeJsonLogicOperations';\nimport { getDatetimeRuleProcessorCEL } from './getDatetimeRuleProcessorCEL';\nimport { getDatetimeRuleProcessorMongoDBQuery } from './getDatetimeRuleProcessorMongoDBQuery';\nimport { getDatetimeRuleProcessorNL } from './getDatetimeRuleProcessorNL';\nimport {\n getDatetimeRuleProcessorSQL,\n getDatetimeValueProcessorANSI,\n getDatetimeValueProcessorMSSQL,\n getDatetimeValueProcessorMySQL,\n getDatetimeValueProcessorOracle,\n getDatetimeValueProcessorPostgreSQL,\n} from './getDatetimeRuleProcessorSQL';\nimport { rqbDateTimeLibraryAPI } from './rqbDateTimeLibraryAPI.dayjs';\nimport type { RQBJsonLogicDateTimeOperations } from './types';\n\n/**\n * Custom JsonLogic date/time operations using Day.js\n */\nexport const jsonLogicDateTimeOperations: RQBJsonLogicDateTimeOperations =\n getDatetimeJsonLogicOperations(rqbDateTimeLibraryAPI);\n\n/**\n * {@link react-querybuilder!index.formatQuery formatQuery} rule processor for \"sql\" format using Day.js\n */\nexport const datetimeRuleProcessorSQL: RuleProcessor =\n getDatetimeRuleProcessorSQL(rqbDateTimeLibraryAPI);\n/**\n * {@link react-querybuilder!index.formatQuery formatQuery} value processor for \"sql\" format (\"ansi\" preset) using Day.js\n */\nexport const datetimeValueProcessorANSI: ValueProcessorByRule =\n getDatetimeValueProcessorANSI(rqbDateTimeLibraryAPI);\n/**\n * {@link react-querybuilder!index.formatQuery formatQuery} value processor for \"sql\" format (\"mssql\" preset) using Day.js\n */\nexport const datetimeValueProcessorMSSQL: ValueProcessorByRule =\n getDatetimeValueProcessorMSSQL(rqbDateTimeLibraryAPI);\n/**\n * {@link react-querybuilder!index.formatQuery formatQuery} value processor for \"sql\" format (\"mysql\" preset) using Day.js\n */\nexport const datetimeValueProcessorMySQL: ValueProcessorByRule =\n getDatetimeValueProcessorMySQL(rqbDateTimeLibraryAPI);\n/**\n * {@link react-querybuilder!index.formatQuery formatQuery} value processor for \"sql\" format (\"oracle\" preset) using Day.js\n */\nexport const datetimeValueProcessorOracle: ValueProcessorByRule =\n getDatetimeValueProcessorOracle(rqbDateTimeLibraryAPI);\n/**\n * {@link react-querybuilder!index.formatQuery formatQuery} value processor for \"sql\" format (\"postgresql\" preset) using Day.js\n */\nexport const datetimeValueProcessorPostgreSQL: ValueProcessorByRule =\n getDatetimeValueProcessorPostgreSQL(rqbDateTimeLibraryAPI);\n\n/**\n * {@link react-querybuilder!index.formatQuery formatQuery} rule processor for \"cel\" format using Day.js\n */\nexport const datetimeRuleProcessorCEL: ValueProcessorByRule =\n getDatetimeRuleProcessorCEL(rqbDateTimeLibraryAPI);\n\n/**\n * {@link react-querybuilder!index.formatQuery formatQuery} rule processor for \"mongodb_query\" format using Day.js\n */\nexport const datetimeRuleProcessorMongoDBQuery: ValueProcessorByRule =\n getDatetimeRuleProcessorMongoDBQuery(rqbDateTimeLibraryAPI);\n\n/**\n * {@link react-querybuilder!index.formatQuery formatQuery} rule processor for \"natural_language\" format using Day.js\n */\nexport const datetimeRuleProcessorNL: ValueProcessorByRule =\n getDatetimeRuleProcessorNL(rqbDateTimeLibraryAPI);\n\nexport * from './rqbDateTimeLibraryAPI.dayjs';\n"],"mappings":";;;;;;;AAOA,MAAaA,wBAA+C;CAC1D,SAAS,GAAG,QAAQ,MAAM,GAAG,OAAO;CACpC,UAAU,GAAG,MAAM,MAAM,GAAG,QAAQ;CACpC,WAAW,GAAG,MAAM,MAAM,GAAG,SAAS;CACtC,SAAS,GAAG,MACV,MAAM,GAAG,OAAO,GAAG,oBAAoB,MAAM,oBAAoB,KAAK,MAAM;CAC9E,UAAS,MAAK,MAAM,GAAG;CACvB,SAAQ,MAAK,MAAM,GAAG;CACtB,cAAa,MAAK;EAChB,MAAM,UAAU,MAAM;AACtB,SAAO,QAAQ,YAAY,QAAQ,gBAAgB;;CAErD,sBAAqB,MAAK;EACxB,MAAM,UAAU,MAAM;AACtB,SAAO,QAAQ,YAAY,QAAQ,OAAO,gBAAgB;;;;;;;;;ACI9D,MAAaC,8BACX,+BAA+B;;;;AAKjC,MAAaC,2BACX,4BAA4B;;;;AAI9B,MAAaC,6BACX,8BAA8B;;;;AAIhC,MAAaC,8BACX,+BAA+B;;;;AAIjC,MAAaC,8BACX,+BAA+B;;;;AAIjC,MAAaC,+BACX,gCAAgC;;;;AAIlC,MAAaC,mCACX,oCAAoC;;;;AAKtC,MAAaC,2BACX,4BAA4B;;;;AAK9B,MAAaC,oCACX,qCAAqC;;;;AAKvC,MAAaC,0BACX,2BAA2B"}
|
|
@@ -1,120 +1,108 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getDatetimeJsonLogicOperations,
|
|
3
|
-
getDatetimeRuleProcessorCEL,
|
|
4
|
-
getDatetimeRuleProcessorMongoDBQuery,
|
|
5
|
-
getDatetimeRuleProcessorNL,
|
|
6
|
-
getDatetimeRuleProcessorSQL,
|
|
7
|
-
getDatetimeValueProcessorANSI,
|
|
8
|
-
getDatetimeValueProcessorMSSQL,
|
|
9
|
-
getDatetimeValueProcessorMySQL,
|
|
10
|
-
getDatetimeValueProcessorOracle,
|
|
11
|
-
getDatetimeValueProcessorPostgreSQL,
|
|
12
|
-
isISOStringDateOnly
|
|
13
|
-
} from "./chunk-ZLH5EH6W.mjs";
|
|
1
|
+
import { getDatetimeJsonLogicOperations, getDatetimeRuleProcessorCEL, getDatetimeRuleProcessorMongoDBQuery, getDatetimeRuleProcessorNL, getDatetimeRuleProcessorSQL, getDatetimeValueProcessorANSI, getDatetimeValueProcessorMSSQL, getDatetimeValueProcessorMySQL, getDatetimeValueProcessorOracle, getDatetimeValueProcessorPostgreSQL, isISOStringDateOnly } from "./getDatetimeRuleProcessorSQL-CocyaiI5.mjs";
|
|
14
2
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
function _iterableToArrayLimit(r, l) {
|
|
35
|
-
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
36
|
-
if (null != t) {
|
|
37
|
-
var e, n, i, u, a = [], f = true, o = false;
|
|
38
|
-
try {
|
|
39
|
-
if (i = (t = t.call(r)).next, 0 === l) {
|
|
40
|
-
if (Object(t) !== t) return;
|
|
41
|
-
f = false;
|
|
42
|
-
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = true) ;
|
|
43
|
-
} catch (r2) {
|
|
44
|
-
o = true, n = r2;
|
|
45
|
-
} finally {
|
|
46
|
-
try {
|
|
47
|
-
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
|
|
48
|
-
} finally {
|
|
49
|
-
if (o) throw n;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
return a;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
function _arrayWithHoles(r) {
|
|
56
|
-
if (Array.isArray(r)) return r;
|
|
57
|
-
}
|
|
58
|
-
var invalidDate = new Date(Number.NaN);
|
|
59
|
-
var dateRegExp = /^(\d{4})-(\d{2})-(\d{2})([T ](\d{2}):(\d{2}):(\d{2})(\.(\d{1,3}))?)?/;
|
|
60
|
-
var toDate = function toDate2(d) {
|
|
61
|
-
if (d instanceof Date) return d;
|
|
62
|
-
var reMatch = dateRegExp.exec(d);
|
|
63
|
-
if (!reMatch) return invalidDate;
|
|
64
|
-
var _reMatch = _slicedToArray(reMatch, 10), _all = _reMatch[0], yyyy = _reMatch[1], mm = _reMatch[2], dd = _reMatch[3], _time = _reMatch[4], hh = _reMatch[5], mi = _reMatch[6], ss = _reMatch[7], _decimal = _reMatch[8], sss = _reMatch[9];
|
|
65
|
-
var _filter$map = [yyyy, mm, dd, hh, mi, ss, sss !== null && sss !== void 0 ? sss : "0"].filter(Boolean).map(Number), _filter$map2 = _slicedToArray(_filter$map, 7), year = _filter$map2[0], month = _filter$map2[1], day = _filter$map2[2], hours = _filter$map2[3], minutes = _filter$map2[4], seconds = _filter$map2[5], ms = _filter$map2[6];
|
|
66
|
-
var monthIndex = month - 1;
|
|
67
|
-
return hh ? new Date(Date.UTC(year, monthIndex, day, hours, minutes, seconds, ms)) : new Date(year, monthIndex, day);
|
|
3
|
+
//#region src/rqbDateTimeLibraryAPI.jsdate.ts
|
|
4
|
+
const invalidDate = /* @__PURE__ */ new Date(NaN);
|
|
5
|
+
const dateRegExp = /^(\d{4})-(\d{2})-(\d{2})([T ](\d{2}):(\d{2}):(\d{2})(\.(\d{1,3}))?)?/;
|
|
6
|
+
const toDate = (d) => {
|
|
7
|
+
if (d instanceof Date) return d;
|
|
8
|
+
const reMatch = dateRegExp.exec(d);
|
|
9
|
+
if (!reMatch) return invalidDate;
|
|
10
|
+
const [_all, yyyy, mm, dd, _time, hh, mi, ss, _decimal, sss] = reMatch;
|
|
11
|
+
const [year, month, day, hours, minutes, seconds, ms] = [
|
|
12
|
+
yyyy,
|
|
13
|
+
mm,
|
|
14
|
+
dd,
|
|
15
|
+
hh,
|
|
16
|
+
mi,
|
|
17
|
+
ss,
|
|
18
|
+
sss ?? "0"
|
|
19
|
+
].filter(Boolean).map(Number);
|
|
20
|
+
const monthIndex = month - 1;
|
|
21
|
+
return hh ? new Date(Date.UTC(year, monthIndex, day, hours, minutes, seconds, ms)) : new Date(year, monthIndex, day);
|
|
68
22
|
};
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
23
|
+
const isValid = (d) => {
|
|
24
|
+
const dToDate = toDate(d);
|
|
25
|
+
return dToDate instanceof Date && !Number.isNaN(dToDate.getTime());
|
|
72
26
|
};
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
27
|
+
const toISOStringDateOnly = (d) => {
|
|
28
|
+
const dToDate = toDate(d);
|
|
29
|
+
return isValid(dToDate) ? dToDate.toISOString().slice(0, 10) : "";
|
|
76
30
|
};
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
},
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
export {
|
|
108
|
-
datetimeRuleProcessorCEL,
|
|
109
|
-
datetimeRuleProcessorMongoDBQuery,
|
|
110
|
-
datetimeRuleProcessorNL,
|
|
111
|
-
datetimeRuleProcessorSQL,
|
|
112
|
-
datetimeValueProcessorANSI,
|
|
113
|
-
datetimeValueProcessorMSSQL,
|
|
114
|
-
datetimeValueProcessorMySQL,
|
|
115
|
-
datetimeValueProcessorOracle,
|
|
116
|
-
datetimeValueProcessorPostgreSQL,
|
|
117
|
-
jsonLogicDateTimeOperations,
|
|
118
|
-
rqbDateTimeLibraryAPI
|
|
31
|
+
/**
|
|
32
|
+
* {@link RQBDateTimeLibraryAPI} for JavaScript `Date`
|
|
33
|
+
*
|
|
34
|
+
* @deprecated This API will not be removed, but we recommend using one of the other
|
|
35
|
+
* {@link RQBDateTimeLibraryAPI}s based on a popular library instead.
|
|
36
|
+
*/
|
|
37
|
+
const rqbDateTimeLibraryAPI = {
|
|
38
|
+
format: (d) => toDate(d).toISOString(),
|
|
39
|
+
isAfter: (a, b) => {
|
|
40
|
+
const dateA = toDate(a).getTime();
|
|
41
|
+
const dateB = toDate(b).getTime();
|
|
42
|
+
return !Number.isNaN(dateA) && !Number.isNaN(dateB) && dateA > dateB;
|
|
43
|
+
},
|
|
44
|
+
isBefore: (a, b) => {
|
|
45
|
+
const dateA = toDate(a).getTime();
|
|
46
|
+
const dateB = toDate(b).getTime();
|
|
47
|
+
return !Number.isNaN(dateA) && !Number.isNaN(dateB) && dateA < dateB;
|
|
48
|
+
},
|
|
49
|
+
isSame: (a, b) => {
|
|
50
|
+
const aToDate = toDate(a);
|
|
51
|
+
const bToDate = toDate(b);
|
|
52
|
+
return isISOStringDateOnly(a) || isISOStringDateOnly(b) ? toISOStringDateOnly(a) === toISOStringDateOnly(b) : aToDate.getTime() === bToDate.getTime();
|
|
53
|
+
},
|
|
54
|
+
isValid,
|
|
55
|
+
toDate,
|
|
56
|
+
toISOString: (d) => {
|
|
57
|
+
const dToDate = toDate(d);
|
|
58
|
+
return isValid(dToDate) ? dToDate.toISOString() : "";
|
|
59
|
+
},
|
|
60
|
+
toISOStringDateOnly
|
|
119
61
|
};
|
|
62
|
+
|
|
63
|
+
//#endregion
|
|
64
|
+
//#region src/index.jsdate.ts
|
|
65
|
+
/**
|
|
66
|
+
* Custom JsonLogic date/time operations using JavaScript `Date`.
|
|
67
|
+
*/
|
|
68
|
+
const jsonLogicDateTimeOperations = getDatetimeJsonLogicOperations(rqbDateTimeLibraryAPI);
|
|
69
|
+
/**
|
|
70
|
+
* {@link react-querybuilder!index.formatQuery formatQuery} rule processor for "sql" format using JavaScript `Date`
|
|
71
|
+
*/
|
|
72
|
+
const datetimeRuleProcessorSQL = getDatetimeRuleProcessorSQL(rqbDateTimeLibraryAPI);
|
|
73
|
+
/**
|
|
74
|
+
* {@link react-querybuilder!index.formatQuery formatQuery} value processor for "sql" format ("ansi" preset) using JavaScript `Date`
|
|
75
|
+
*/
|
|
76
|
+
const datetimeValueProcessorANSI = getDatetimeValueProcessorANSI(rqbDateTimeLibraryAPI);
|
|
77
|
+
/**
|
|
78
|
+
* {@link react-querybuilder!index.formatQuery formatQuery} value processor for "sql" format ("mssql" preset) using JavaScript `Date`
|
|
79
|
+
*/
|
|
80
|
+
const datetimeValueProcessorMSSQL = getDatetimeValueProcessorMSSQL(rqbDateTimeLibraryAPI);
|
|
81
|
+
/**
|
|
82
|
+
* {@link react-querybuilder!index.formatQuery formatQuery} value processor for "sql" format ("mysql" preset) using JavaScript `Date`
|
|
83
|
+
*/
|
|
84
|
+
const datetimeValueProcessorMySQL = getDatetimeValueProcessorMySQL(rqbDateTimeLibraryAPI);
|
|
85
|
+
/**
|
|
86
|
+
* {@link react-querybuilder!index.formatQuery formatQuery} value processor for "sql" format ("oracle" preset) using JavaScript `Date`
|
|
87
|
+
*/
|
|
88
|
+
const datetimeValueProcessorOracle = getDatetimeValueProcessorOracle(rqbDateTimeLibraryAPI);
|
|
89
|
+
/**
|
|
90
|
+
* {@link react-querybuilder!index.formatQuery formatQuery} value processor for "sql" format ("postgresql" preset) using JavaScript `Date`
|
|
91
|
+
*/
|
|
92
|
+
const datetimeValueProcessorPostgreSQL = getDatetimeValueProcessorPostgreSQL(rqbDateTimeLibraryAPI);
|
|
93
|
+
/**
|
|
94
|
+
* {@link react-querybuilder!index.formatQuery formatQuery} rule processor for "cel" format using JavaScript `Date`
|
|
95
|
+
*/
|
|
96
|
+
const datetimeRuleProcessorCEL = getDatetimeRuleProcessorCEL(rqbDateTimeLibraryAPI);
|
|
97
|
+
/**
|
|
98
|
+
* {@link react-querybuilder!index.formatQuery formatQuery} rule processor for "mongodb_query" format using JavaScript `Date`
|
|
99
|
+
*/
|
|
100
|
+
const datetimeRuleProcessorMongoDBQuery = getDatetimeRuleProcessorMongoDBQuery(rqbDateTimeLibraryAPI);
|
|
101
|
+
/**
|
|
102
|
+
* {@link react-querybuilder!index.formatQuery formatQuery} rule processor for "natural_language" format using JavaScript `Date`
|
|
103
|
+
*/
|
|
104
|
+
const datetimeRuleProcessorNL = getDatetimeRuleProcessorNL(rqbDateTimeLibraryAPI);
|
|
105
|
+
|
|
106
|
+
//#endregion
|
|
107
|
+
export { datetimeRuleProcessorCEL, datetimeRuleProcessorMongoDBQuery, datetimeRuleProcessorNL, datetimeRuleProcessorSQL, datetimeValueProcessorANSI, datetimeValueProcessorMSSQL, datetimeValueProcessorMySQL, datetimeValueProcessorOracle, datetimeValueProcessorPostgreSQL, jsonLogicDateTimeOperations, rqbDateTimeLibraryAPI };
|
|
120
108
|
//# sourceMappingURL=react-querybuilder_datetime.jsdate.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"react-querybuilder_datetime.jsdate.mjs","names":["rqbDateTimeLibraryAPI: RQBDateTimeLibraryAPI","jsonLogicDateTimeOperations: RQBJsonLogicDateTimeOperations","datetimeRuleProcessorSQL: RuleProcessor","datetimeValueProcessorANSI: ValueProcessorByRule","datetimeValueProcessorMSSQL: ValueProcessorByRule","datetimeValueProcessorMySQL: ValueProcessorByRule","datetimeValueProcessorOracle: ValueProcessorByRule","datetimeValueProcessorPostgreSQL: ValueProcessorByRule","datetimeRuleProcessorCEL: RuleProcessor","datetimeRuleProcessorMongoDBQuery: RuleProcessor","datetimeRuleProcessorNL: ValueProcessorByRule"],"sources":["../src/rqbDateTimeLibraryAPI.jsdate.ts","../src/index.jsdate.ts"],"sourcesContent":["import type { RQBDateTimeLibraryAPI } from './types';\nimport { isISOStringDateOnly } from './utils';\n\nconst invalidDate = new Date(Number.NaN);\n\nconst dateRegExp = /^(\\d{4})-(\\d{2})-(\\d{2})([T ](\\d{2}):(\\d{2}):(\\d{2})(\\.(\\d{1,3}))?)?/;\n\nconst toDate = (d: string | Date) => {\n if (d instanceof Date) return d;\n\n const reMatch = dateRegExp.exec(d);\n\n if (!reMatch) return invalidDate;\n\n const [_all, yyyy, mm, dd, _time, hh, mi, ss, _decimal, sss] = reMatch;\n const [year, month, day, hours, minutes, seconds, ms] = [yyyy, mm, dd, hh, mi, ss, sss ?? '0']\n .filter(Boolean)\n .map(Number);\n\n const monthIndex = month - 1;\n\n return hh\n ? new Date(Date.UTC(year, monthIndex, day, hours, minutes, seconds, ms))\n : new Date(year, monthIndex, day);\n};\n\nconst isValid = (d: string | Date) => {\n const dToDate = toDate(d);\n return dToDate instanceof Date && !Number.isNaN(dToDate.getTime());\n};\n\nconst toISOStringDateOnly = (d: string | Date) => {\n const dToDate = toDate(d);\n return isValid(dToDate) ? dToDate.toISOString().slice(0, 10) : '';\n};\n\n/**\n * {@link RQBDateTimeLibraryAPI} for JavaScript `Date`\n *\n * @deprecated This API will not be removed, but we recommend using one of the other\n * {@link RQBDateTimeLibraryAPI}s based on a popular library instead.\n */\nexport const rqbDateTimeLibraryAPI: RQBDateTimeLibraryAPI = {\n format: d => toDate(d).toISOString(),\n isAfter: (a, b) => {\n const dateA = toDate(a).getTime();\n const dateB = toDate(b).getTime();\n return !Number.isNaN(dateA) && !Number.isNaN(dateB) && dateA > dateB;\n },\n isBefore: (a, b) => {\n const dateA = toDate(a).getTime();\n const dateB = toDate(b).getTime();\n return !Number.isNaN(dateA) && !Number.isNaN(dateB) && dateA < dateB;\n },\n isSame: (a, b) => {\n const aToDate = toDate(a);\n const bToDate = toDate(b);\n return isISOStringDateOnly(a) || isISOStringDateOnly(b)\n ? toISOStringDateOnly(a) === toISOStringDateOnly(b)\n : aToDate.getTime() === bToDate.getTime();\n },\n isValid,\n toDate,\n toISOString: d => {\n const dToDate = toDate(d);\n return isValid(dToDate) ? dToDate.toISOString() : '';\n },\n toISOStringDateOnly,\n};\n","/**\n * Import from `\"@react-querybuilder/datetime/jsdate\"` for enhanced date/time support using a custom JavaScript `Date`-based library.\n *\n * @module jsdate\n */\n\nimport type { RuleProcessor, ValueProcessorByRule } from 'react-querybuilder';\nimport { getDatetimeJsonLogicOperations } from './getDatetimeJsonLogicOperations';\nimport { getDatetimeRuleProcessorCEL } from './getDatetimeRuleProcessorCEL';\nimport { getDatetimeRuleProcessorMongoDBQuery } from './getDatetimeRuleProcessorMongoDBQuery';\nimport { getDatetimeRuleProcessorNL } from './getDatetimeRuleProcessorNL';\nimport {\n getDatetimeRuleProcessorSQL,\n getDatetimeValueProcessorANSI,\n getDatetimeValueProcessorMSSQL,\n getDatetimeValueProcessorMySQL,\n getDatetimeValueProcessorOracle,\n getDatetimeValueProcessorPostgreSQL,\n} from './getDatetimeRuleProcessorSQL';\nimport { rqbDateTimeLibraryAPI } from './rqbDateTimeLibraryAPI.jsdate';\nimport type { RQBJsonLogicDateTimeOperations } from './types';\n\n/**\n * Custom JsonLogic date/time operations using JavaScript `Date`.\n */\nexport const jsonLogicDateTimeOperations: RQBJsonLogicDateTimeOperations =\n getDatetimeJsonLogicOperations(rqbDateTimeLibraryAPI);\n\n/**\n * {@link react-querybuilder!index.formatQuery formatQuery} rule processor for \"sql\" format using JavaScript `Date`\n */\nexport const datetimeRuleProcessorSQL: RuleProcessor =\n getDatetimeRuleProcessorSQL(rqbDateTimeLibraryAPI);\n/**\n * {@link react-querybuilder!index.formatQuery formatQuery} value processor for \"sql\" format (\"ansi\" preset) using JavaScript `Date`\n */\nexport const datetimeValueProcessorANSI: ValueProcessorByRule =\n getDatetimeValueProcessorANSI(rqbDateTimeLibraryAPI);\n/**\n * {@link react-querybuilder!index.formatQuery formatQuery} value processor for \"sql\" format (\"mssql\" preset) using JavaScript `Date`\n */\nexport const datetimeValueProcessorMSSQL: ValueProcessorByRule =\n getDatetimeValueProcessorMSSQL(rqbDateTimeLibraryAPI);\n/**\n * {@link react-querybuilder!index.formatQuery formatQuery} value processor for \"sql\" format (\"mysql\" preset) using JavaScript `Date`\n */\nexport const datetimeValueProcessorMySQL: ValueProcessorByRule =\n getDatetimeValueProcessorMySQL(rqbDateTimeLibraryAPI);\n/**\n * {@link react-querybuilder!index.formatQuery formatQuery} value processor for \"sql\" format (\"oracle\" preset) using JavaScript `Date`\n */\nexport const datetimeValueProcessorOracle: ValueProcessorByRule =\n getDatetimeValueProcessorOracle(rqbDateTimeLibraryAPI);\n/**\n * {@link react-querybuilder!index.formatQuery formatQuery} value processor for \"sql\" format (\"postgresql\" preset) using JavaScript `Date`\n */\nexport const datetimeValueProcessorPostgreSQL: ValueProcessorByRule =\n getDatetimeValueProcessorPostgreSQL(rqbDateTimeLibraryAPI);\n\n/**\n * {@link react-querybuilder!index.formatQuery formatQuery} rule processor for \"cel\" format using JavaScript `Date`\n */\nexport const datetimeRuleProcessorCEL: RuleProcessor =\n getDatetimeRuleProcessorCEL(rqbDateTimeLibraryAPI);\n\n/**\n * {@link react-querybuilder!index.formatQuery formatQuery} rule processor for \"mongodb_query\" format using JavaScript `Date`\n */\nexport const datetimeRuleProcessorMongoDBQuery: RuleProcessor =\n getDatetimeRuleProcessorMongoDBQuery(rqbDateTimeLibraryAPI);\n\n/**\n * {@link react-querybuilder!index.formatQuery formatQuery} rule processor for \"natural_language\" format using JavaScript `Date`\n */\nexport const datetimeRuleProcessorNL: ValueProcessorByRule =\n getDatetimeRuleProcessorNL(rqbDateTimeLibraryAPI);\n\nexport * from './rqbDateTimeLibraryAPI.jsdate';\n"],"mappings":";;;AAGA,MAAM,8BAAc,IAAI,KAAK;AAE7B,MAAM,aAAa;AAEnB,MAAM,UAAU,MAAqB;AACnC,KAAI,aAAa,KAAM,QAAO;CAE9B,MAAM,UAAU,WAAW,KAAK;AAEhC,KAAI,CAAC,QAAS,QAAO;CAErB,MAAM,CAAC,MAAM,MAAM,IAAI,IAAI,OAAO,IAAI,IAAI,IAAI,UAAU,OAAO;CAC/D,MAAM,CAAC,MAAM,OAAO,KAAK,OAAO,SAAS,SAAS,MAAM;EAAC;EAAM;EAAI;EAAI;EAAI;EAAI;EAAI,OAAO;GACvF,OAAO,SACP,IAAI;CAEP,MAAM,aAAa,QAAQ;AAE3B,QAAO,KACH,IAAI,KAAK,KAAK,IAAI,MAAM,YAAY,KAAK,OAAO,SAAS,SAAS,OAClE,IAAI,KAAK,MAAM,YAAY;;AAGjC,MAAM,WAAW,MAAqB;CACpC,MAAM,UAAU,OAAO;AACvB,QAAO,mBAAmB,QAAQ,CAAC,OAAO,MAAM,QAAQ;;AAG1D,MAAM,uBAAuB,MAAqB;CAChD,MAAM,UAAU,OAAO;AACvB,QAAO,QAAQ,WAAW,QAAQ,cAAc,MAAM,GAAG,MAAM;;;;;;;;AASjE,MAAaA,wBAA+C;CAC1D,SAAQ,MAAK,OAAO,GAAG;CACvB,UAAU,GAAG,MAAM;EACjB,MAAM,QAAQ,OAAO,GAAG;EACxB,MAAM,QAAQ,OAAO,GAAG;AACxB,SAAO,CAAC,OAAO,MAAM,UAAU,CAAC,OAAO,MAAM,UAAU,QAAQ;;CAEjE,WAAW,GAAG,MAAM;EAClB,MAAM,QAAQ,OAAO,GAAG;EACxB,MAAM,QAAQ,OAAO,GAAG;AACxB,SAAO,CAAC,OAAO,MAAM,UAAU,CAAC,OAAO,MAAM,UAAU,QAAQ;;CAEjE,SAAS,GAAG,MAAM;EAChB,MAAM,UAAU,OAAO;EACvB,MAAM,UAAU,OAAO;AACvB,SAAO,oBAAoB,MAAM,oBAAoB,KACjD,oBAAoB,OAAO,oBAAoB,KAC/C,QAAQ,cAAc,QAAQ;;CAEpC;CACA;CACA,cAAa,MAAK;EAChB,MAAM,UAAU,OAAO;AACvB,SAAO,QAAQ,WAAW,QAAQ,gBAAgB;;CAEpD;;;;;;;;AC1CF,MAAaC,8BACX,+BAA+B;;;;AAKjC,MAAaC,2BACX,4BAA4B;;;;AAI9B,MAAaC,6BACX,8BAA8B;;;;AAIhC,MAAaC,8BACX,+BAA+B;;;;AAIjC,MAAaC,8BACX,+BAA+B;;;;AAIjC,MAAaC,+BACX,gCAAgC;;;;AAIlC,MAAaC,mCACX,oCAAoC;;;;AAKtC,MAAaC,2BACX,4BAA4B;;;;AAK9B,MAAaC,oCACX,qCAAqC;;;;AAKvC,MAAaC,0BACX,2BAA2B"}
|
|
@@ -1,61 +1,76 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
getDatetimeRuleProcessorCEL,
|
|
4
|
-
getDatetimeRuleProcessorMongoDBQuery,
|
|
5
|
-
getDatetimeRuleProcessorNL,
|
|
6
|
-
getDatetimeRuleProcessorSQL,
|
|
7
|
-
getDatetimeValueProcessorANSI,
|
|
8
|
-
getDatetimeValueProcessorMSSQL,
|
|
9
|
-
getDatetimeValueProcessorMySQL,
|
|
10
|
-
getDatetimeValueProcessorOracle,
|
|
11
|
-
getDatetimeValueProcessorPostgreSQL,
|
|
12
|
-
isISOStringDateOnly
|
|
13
|
-
} from "./chunk-ZS6AX35I.js";
|
|
1
|
+
import { getDatetimeJsonLogicOperations, getDatetimeRuleProcessorCEL, getDatetimeRuleProcessorMongoDBQuery, getDatetimeRuleProcessorNL, getDatetimeRuleProcessorSQL, getDatetimeValueProcessorANSI, getDatetimeValueProcessorMSSQL, getDatetimeValueProcessorMySQL, getDatetimeValueProcessorOracle, getDatetimeValueProcessorPostgreSQL, isISOStringDateOnly } from "./getDatetimeRuleProcessorSQL-CutYTD23.js";
|
|
2
|
+
import { format, isAfter, isBefore, isSameDay, isValid, parseISO, toDate } from "date-fns";
|
|
14
3
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
4
|
+
//#region src/rqbDateTimeLibraryAPI.date-fns.ts
|
|
5
|
+
const toDate$1 = (a) => typeof a === "string" ? parseISO(a) : toDate(a);
|
|
6
|
+
const iso8601DateOnly = "yyyy-MM-dd";
|
|
7
|
+
/**
|
|
8
|
+
* {@link RQBDateTimeLibraryAPI} for date-fns
|
|
9
|
+
*/
|
|
10
|
+
const rqbDateTimeLibraryAPI = {
|
|
11
|
+
format: (d, fmt) => format(toDate$1(d), fmt.replace("YYYY-MM-DD", iso8601DateOnly)),
|
|
12
|
+
isAfter,
|
|
13
|
+
isBefore,
|
|
14
|
+
isSame: (a, b) => {
|
|
15
|
+
const aToDate = toDate$1(a);
|
|
16
|
+
const bToDate = toDate$1(b);
|
|
17
|
+
return isISOStringDateOnly(a) || isISOStringDateOnly(b) ? isSameDay(aToDate, bToDate) : aToDate.getTime() === bToDate.getTime();
|
|
18
|
+
},
|
|
19
|
+
isValid: (d) => isValid(toDate$1(d)),
|
|
20
|
+
toDate: toDate$1,
|
|
21
|
+
toISOString: (d) => {
|
|
22
|
+
const dToDate = toDate$1(d);
|
|
23
|
+
return isValid(dToDate) ? dToDate.toISOString() : "";
|
|
24
|
+
},
|
|
25
|
+
toISOStringDateOnly: (d) => {
|
|
26
|
+
const dToDate = toDate$1(d);
|
|
27
|
+
return isValid(dToDate) ? format(dToDate, iso8601DateOnly) : "";
|
|
28
|
+
}
|
|
19
29
|
};
|
|
20
|
-
var iso8601DateOnly = "yyyy-MM-dd";
|
|
21
|
-
var rqbDateTimeLibraryAPI = { format: function format(d, fmt) {
|
|
22
|
-
return _format(toDate(d), fmt.replace("YYYY-MM-DD", iso8601DateOnly));
|
|
23
|
-
}, isAfter, isBefore, isSame: function isSame(a, b) {
|
|
24
|
-
var aToDate = toDate(a);
|
|
25
|
-
var bToDate = toDate(b);
|
|
26
|
-
return isISOStringDateOnly(a) || isISOStringDateOnly(b) ? isSameDay(aToDate, bToDate) : aToDate.getTime() === bToDate.getTime();
|
|
27
|
-
}, isValid: function isValid(d) {
|
|
28
|
-
return _isValid(toDate(d));
|
|
29
|
-
}, toDate, toISOString: function toISOString(d) {
|
|
30
|
-
var dToDate = toDate(d);
|
|
31
|
-
return _isValid(dToDate) ? dToDate.toISOString() : "";
|
|
32
|
-
}, toISOStringDateOnly: function toISOStringDateOnly(d) {
|
|
33
|
-
var dToDate = toDate(d);
|
|
34
|
-
return _isValid(dToDate) ? _format(dToDate, iso8601DateOnly) : "";
|
|
35
|
-
} };
|
|
36
30
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
31
|
+
//#endregion
|
|
32
|
+
//#region src/index.date-fns.ts
|
|
33
|
+
/**
|
|
34
|
+
* Custom JsonLogic date/time operations using date-fns
|
|
35
|
+
*/
|
|
36
|
+
const jsonLogicDateTimeOperations = getDatetimeJsonLogicOperations(rqbDateTimeLibraryAPI);
|
|
37
|
+
/**
|
|
38
|
+
* {@link react-querybuilder!index.formatQuery formatQuery} rule processor for "sql" format using date-fns
|
|
39
|
+
*/
|
|
40
|
+
const datetimeRuleProcessorSQL = getDatetimeRuleProcessorSQL(rqbDateTimeLibraryAPI);
|
|
41
|
+
/**
|
|
42
|
+
* {@link react-querybuilder!index.formatQuery formatQuery} value processor for "sql" format ("ansi" preset) using date-fns
|
|
43
|
+
*/
|
|
44
|
+
const datetimeValueProcessorANSI = getDatetimeValueProcessorANSI(rqbDateTimeLibraryAPI);
|
|
45
|
+
/**
|
|
46
|
+
* {@link react-querybuilder!index.formatQuery formatQuery} value processor for "sql" format ("mssql" preset) using date-fns
|
|
47
|
+
*/
|
|
48
|
+
const datetimeValueProcessorMSSQL = getDatetimeValueProcessorMSSQL(rqbDateTimeLibraryAPI);
|
|
49
|
+
/**
|
|
50
|
+
* {@link react-querybuilder!index.formatQuery formatQuery} value processor for "sql" format ("mysql" preset) using date-fns
|
|
51
|
+
*/
|
|
52
|
+
const datetimeValueProcessorMySQL = getDatetimeValueProcessorMySQL(rqbDateTimeLibraryAPI);
|
|
53
|
+
/**
|
|
54
|
+
* {@link react-querybuilder!index.formatQuery formatQuery} value processor for "sql" format ("oracle" preset) using date-fns
|
|
55
|
+
*/
|
|
56
|
+
const datetimeValueProcessorOracle = getDatetimeValueProcessorOracle(rqbDateTimeLibraryAPI);
|
|
57
|
+
/**
|
|
58
|
+
* {@link react-querybuilder!index.formatQuery formatQuery} value processor for "sql" format ("postgresql" preset) using date-fns
|
|
59
|
+
*/
|
|
60
|
+
const datetimeValueProcessorPostgreSQL = getDatetimeValueProcessorPostgreSQL(rqbDateTimeLibraryAPI);
|
|
61
|
+
/**
|
|
62
|
+
* {@link react-querybuilder!index.formatQuery formatQuery} rule processor for "cel" format using date-fns
|
|
63
|
+
*/
|
|
64
|
+
const datetimeRuleProcessorCEL = getDatetimeRuleProcessorCEL(rqbDateTimeLibraryAPI);
|
|
65
|
+
/**
|
|
66
|
+
* {@link react-querybuilder!index.formatQuery formatQuery} rule processor for "mongodb_query" format using date-fns
|
|
67
|
+
*/
|
|
68
|
+
const datetimeRuleProcessorMongoDBQuery = getDatetimeRuleProcessorMongoDBQuery(rqbDateTimeLibraryAPI);
|
|
69
|
+
/**
|
|
70
|
+
* {@link react-querybuilder!index.formatQuery formatQuery} rule processor for "natural_language" format using date-fns
|
|
71
|
+
*/
|
|
72
|
+
const datetimeRuleProcessorNL = getDatetimeRuleProcessorNL(rqbDateTimeLibraryAPI);
|
|
73
|
+
|
|
74
|
+
//#endregion
|
|
75
|
+
export { datetimeRuleProcessorCEL, datetimeRuleProcessorMongoDBQuery, datetimeRuleProcessorNL, datetimeRuleProcessorSQL, datetimeValueProcessorANSI, datetimeValueProcessorMSSQL, datetimeValueProcessorMySQL, datetimeValueProcessorOracle, datetimeValueProcessorPostgreSQL, jsonLogicDateTimeOperations, rqbDateTimeLibraryAPI };
|
|
61
76
|
//# sourceMappingURL=react-querybuilder_datetime.legacy-esm.date-fns.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/rqbDateTimeLibraryAPI.date-fns.ts","../src/index.date-fns.ts"],"sourcesContent":["import{toDate as dateFnsToDate
|
|
1
|
+
{"version":3,"file":"react-querybuilder_datetime.legacy-esm.date-fns.js","names":["toDate: typeof dateFnsToDate","dateFnsToDate","rqbDateTimeLibraryAPI: RQBDateTimeLibraryAPI","toDate","jsonLogicDateTimeOperations: RQBJsonLogicDateTimeOperations","datetimeRuleProcessorSQL: RuleProcessor","datetimeValueProcessorANSI: ValueProcessorByRule","datetimeValueProcessorMSSQL: ValueProcessorByRule","datetimeValueProcessorMySQL: ValueProcessorByRule","datetimeValueProcessorOracle: ValueProcessorByRule","datetimeValueProcessorPostgreSQL: ValueProcessorByRule","datetimeRuleProcessorCEL: ValueProcessorByRule","datetimeRuleProcessorMongoDBQuery: ValueProcessorByRule","datetimeRuleProcessorNL: ValueProcessorByRule"],"sources":["../src/rqbDateTimeLibraryAPI.date-fns.ts","../src/index.date-fns.ts"],"sourcesContent":["import {\n toDate as dateFnsToDate,\n format,\n isAfter,\n isBefore,\n isSameDay,\n isValid,\n parseISO,\n} from 'date-fns';\nimport type { RQBDateTimeLibraryAPI } from './types';\nimport { isISOStringDateOnly } from './utils';\n\nconst toDate: typeof dateFnsToDate = a => (typeof a === 'string' ? parseISO(a) : dateFnsToDate(a));\nconst iso8601DateOnly = 'yyyy-MM-dd';\n\n/**\n * {@link RQBDateTimeLibraryAPI} for date-fns\n */\nexport const rqbDateTimeLibraryAPI: RQBDateTimeLibraryAPI = {\n format: (d, fmt) => format(toDate(d), fmt.replace('YYYY-MM-DD', iso8601DateOnly)),\n isAfter,\n isBefore,\n isSame: (a, b) => {\n const aToDate = toDate(a);\n const bToDate = toDate(b);\n return isISOStringDateOnly(a) || isISOStringDateOnly(b)\n ? isSameDay(aToDate, bToDate)\n : aToDate.getTime() === bToDate.getTime();\n },\n isValid: d => isValid(toDate(d)),\n toDate,\n toISOString: d => {\n const dToDate = toDate(d);\n return isValid(dToDate) ? dToDate.toISOString() : '';\n },\n toISOStringDateOnly: d => {\n const dToDate = toDate(d);\n return isValid(dToDate) ? format(dToDate, iso8601DateOnly) : '';\n },\n};\n","/**\n * Import from `\"@react-querybuilder/datetime/date-fns\"` for enhanced date/time support using [date-fns](https://date-fns.org/).\n *\n * @module date-fns\n */\n\nimport type { RuleProcessor, ValueProcessorByRule } from 'react-querybuilder';\nimport { getDatetimeJsonLogicOperations } from './getDatetimeJsonLogicOperations';\nimport { getDatetimeRuleProcessorCEL } from './getDatetimeRuleProcessorCEL';\nimport { getDatetimeRuleProcessorMongoDBQuery } from './getDatetimeRuleProcessorMongoDBQuery';\nimport { getDatetimeRuleProcessorNL } from './getDatetimeRuleProcessorNL';\nimport {\n getDatetimeRuleProcessorSQL,\n getDatetimeValueProcessorANSI,\n getDatetimeValueProcessorMSSQL,\n getDatetimeValueProcessorMySQL,\n getDatetimeValueProcessorOracle,\n getDatetimeValueProcessorPostgreSQL,\n} from './getDatetimeRuleProcessorSQL';\nimport { rqbDateTimeLibraryAPI } from './rqbDateTimeLibraryAPI.date-fns';\nimport type { RQBJsonLogicDateTimeOperations } from './types';\n\n/**\n * Custom JsonLogic date/time operations using date-fns\n */\nexport const jsonLogicDateTimeOperations: RQBJsonLogicDateTimeOperations =\n getDatetimeJsonLogicOperations(rqbDateTimeLibraryAPI);\n\n/**\n * {@link react-querybuilder!index.formatQuery formatQuery} rule processor for \"sql\" format using date-fns\n */\nexport const datetimeRuleProcessorSQL: RuleProcessor =\n getDatetimeRuleProcessorSQL(rqbDateTimeLibraryAPI);\n/**\n * {@link react-querybuilder!index.formatQuery formatQuery} value processor for \"sql\" format (\"ansi\" preset) using date-fns\n */\nexport const datetimeValueProcessorANSI: ValueProcessorByRule =\n getDatetimeValueProcessorANSI(rqbDateTimeLibraryAPI);\n/**\n * {@link react-querybuilder!index.formatQuery formatQuery} value processor for \"sql\" format (\"mssql\" preset) using date-fns\n */\nexport const datetimeValueProcessorMSSQL: ValueProcessorByRule =\n getDatetimeValueProcessorMSSQL(rqbDateTimeLibraryAPI);\n/**\n * {@link react-querybuilder!index.formatQuery formatQuery} value processor for \"sql\" format (\"mysql\" preset) using date-fns\n */\nexport const datetimeValueProcessorMySQL: ValueProcessorByRule =\n getDatetimeValueProcessorMySQL(rqbDateTimeLibraryAPI);\n/**\n * {@link react-querybuilder!index.formatQuery formatQuery} value processor for \"sql\" format (\"oracle\" preset) using date-fns\n */\nexport const datetimeValueProcessorOracle: ValueProcessorByRule =\n getDatetimeValueProcessorOracle(rqbDateTimeLibraryAPI);\n/**\n * {@link react-querybuilder!index.formatQuery formatQuery} value processor for \"sql\" format (\"postgresql\" preset) using date-fns\n */\nexport const datetimeValueProcessorPostgreSQL: ValueProcessorByRule =\n getDatetimeValueProcessorPostgreSQL(rqbDateTimeLibraryAPI);\n\n/**\n * {@link react-querybuilder!index.formatQuery formatQuery} rule processor for \"cel\" format using date-fns\n */\nexport const datetimeRuleProcessorCEL: ValueProcessorByRule =\n getDatetimeRuleProcessorCEL(rqbDateTimeLibraryAPI);\n\n/**\n * {@link react-querybuilder!index.formatQuery formatQuery} rule processor for \"mongodb_query\" format using date-fns\n */\nexport const datetimeRuleProcessorMongoDBQuery: ValueProcessorByRule =\n getDatetimeRuleProcessorMongoDBQuery(rqbDateTimeLibraryAPI);\n\n/**\n * {@link react-querybuilder!index.formatQuery formatQuery} rule processor for \"natural_language\" format using date-fns\n */\nexport const datetimeRuleProcessorNL: ValueProcessorByRule =\n getDatetimeRuleProcessorNL(rqbDateTimeLibraryAPI);\n\nexport * from './rqbDateTimeLibraryAPI.date-fns';\n"],"mappings":";;;;AAYA,MAAMA,YAA+B,MAAM,OAAO,MAAM,WAAW,SAAS,KAAKC,OAAc;AAC/F,MAAM,kBAAkB;;;;AAKxB,MAAaC,wBAA+C;CAC1D,SAAS,GAAG,QAAQ,OAAOC,SAAO,IAAI,IAAI,QAAQ,cAAc;CAChE;CACA;CACA,SAAS,GAAG,MAAM;EAChB,MAAM,UAAUA,SAAO;EACvB,MAAM,UAAUA,SAAO;AACvB,SAAO,oBAAoB,MAAM,oBAAoB,KACjD,UAAU,SAAS,WACnB,QAAQ,cAAc,QAAQ;;CAEpC,UAAS,MAAK,QAAQA,SAAO;CAC7B;CACA,cAAa,MAAK;EAChB,MAAM,UAAUA,SAAO;AACvB,SAAO,QAAQ,WAAW,QAAQ,gBAAgB;;CAEpD,sBAAqB,MAAK;EACxB,MAAM,UAAUA,SAAO;AACvB,SAAO,QAAQ,WAAW,OAAO,SAAS,mBAAmB;;;;;;;;;ACZjE,MAAaC,8BACX,+BAA+B;;;;AAKjC,MAAaC,2BACX,4BAA4B;;;;AAI9B,MAAaC,6BACX,8BAA8B;;;;AAIhC,MAAaC,8BACX,+BAA+B;;;;AAIjC,MAAaC,8BACX,+BAA+B;;;;AAIjC,MAAaC,+BACX,gCAAgC;;;;AAIlC,MAAaC,mCACX,oCAAoC;;;;AAKtC,MAAaC,2BACX,4BAA4B;;;;AAK9B,MAAaC,oCACX,qCAAqC;;;;AAKvC,MAAaC,0BACX,2BAA2B"}
|