@opengis/fastify-table 1.1.148 → 1.1.149
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/package.json
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
const dateTypeList = ['date', 'timestamp', 'timestamp without time zone'];
|
|
1
|
+
const dateTypeList = ['date', 'timestamp', 'timestamp without time zone', 'timestamp with time zone'];
|
|
2
2
|
const numberTypeList = ['float8', 'int4', 'int8', 'numeric', 'double precision', 'integer'];
|
|
3
|
+
const isValidDate = (dateStr) => {
|
|
4
|
+
const [dd, mm, yyyy] = dateStr.split('.');
|
|
5
|
+
return new Date(mm + '/' + dd + '/' + yyyy).toString() !== 'Invalid Date';
|
|
6
|
+
};
|
|
3
7
|
|
|
4
8
|
function dt(y, m, d) {
|
|
5
9
|
return new Date(Date.UTC(y, m, d)).toISOString().slice(0, 10);
|
|
@@ -53,6 +57,10 @@ function formatValue({
|
|
|
53
57
|
const [startDate, endDate] = value.split('-');
|
|
54
58
|
const min = formatDateISOString(startDate);
|
|
55
59
|
const max = formatDateISOString(endDate);
|
|
60
|
+
|
|
61
|
+
if (!isValidDate(startDate) || !isValidDate(endDate)) {
|
|
62
|
+
return { op: 'between', query: 'false', extra };
|
|
63
|
+
}
|
|
56
64
|
const query = extra && pk
|
|
57
65
|
? `${pk} in (select object_id from crm.extra_data where property_key='${name}' and value_date::date >= '${min}'::date and value_date::date <= '${max}'::date)`
|
|
58
66
|
: `${name}::date >= '${min}'::date and ${name}::date <= '${max}'::date`;
|