mirror of
https://github.com/zadam/trilium.git
synced 2025-11-11 15:55:52 +01:00
fix using smart values with .dateCreated, closes #1338
This commit is contained in:
@@ -5,9 +5,9 @@ const stringComparators = {
|
||||
">=": comparedValue => (val => val >= comparedValue),
|
||||
"<": comparedValue => (val => val < comparedValue),
|
||||
"<=": comparedValue => (val => val <= comparedValue),
|
||||
"*=": comparedValue => (val => val.endsWith(comparedValue)),
|
||||
"=*": comparedValue => (val => val.startsWith(comparedValue)),
|
||||
"*=*": comparedValue => (val => val.includes(comparedValue)),
|
||||
"*=": comparedValue => (val => val && val.endsWith(comparedValue)),
|
||||
"=*": comparedValue => (val => val && val.startsWith(comparedValue)),
|
||||
"*=*": comparedValue => (val => val && val.includes(comparedValue)),
|
||||
};
|
||||
|
||||
const numericComparators = {
|
||||
|
||||
@@ -80,10 +80,14 @@ function getExpression(tokens, searchContext, level = 0) {
|
||||
|
||||
if (i + 2 < tokens.length) {
|
||||
if (tokens[i + 1].token === '+') {
|
||||
delta += parseInt(tokens[i + 2].token);
|
||||
i += 2;
|
||||
|
||||
delta += parseInt(tokens[i].token);
|
||||
}
|
||||
else if (tokens[i + 1].token === '-') {
|
||||
delta -= parseInt(tokens[i + 2].token);
|
||||
i += 2;
|
||||
|
||||
delta -= parseInt(tokens[i].token);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,16 +200,18 @@ function getExpression(tokens, searchContext, level = 0) {
|
||||
if (PropertyComparisonExp.isProperty(tokens[i].token)) {
|
||||
const propertyName = tokens[i].token;
|
||||
const operator = tokens[i + 1].token;
|
||||
const comparedValue = tokens[i + 2].token;
|
||||
|
||||
i += 2;
|
||||
|
||||
const comparedValue = resolveConstantOperand();
|
||||
|
||||
const comparator = buildComparator(operator, comparedValue);
|
||||
|
||||
if (!comparator) {
|
||||
searchContext.addError(`Can't find operator '${operator}' in ${context(i)}`);
|
||||
searchContext.addError(`Can't find operator '${operator}' in ${context(i - 2)}`);
|
||||
return;
|
||||
}
|
||||
|
||||
i += 2;
|
||||
|
||||
return new PropertyComparisonExp(propertyName, comparator);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user