fix: field path
This commit is contained in:
parent
972e05bac0
commit
c43930fa7c
@ -5,6 +5,20 @@ export class DateField extends Field {
|
|||||||
get dataType() {
|
get dataType() {
|
||||||
return DataTypes.DATE(3);
|
return DataTypes.DATE(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getProps() {
|
||||||
|
return this.options?.uiSchema?.['x-component-props'] || {};
|
||||||
|
}
|
||||||
|
|
||||||
|
isDateOnly() {
|
||||||
|
const props = this.getProps();
|
||||||
|
return !props.showTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
isGMT() {
|
||||||
|
const props = this.getProps();
|
||||||
|
return props.gmt || !props.showTime;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DateFieldOptions extends BaseColumnFieldOptions {
|
export interface DateFieldOptions extends BaseColumnFieldOptions {
|
||||||
|
@ -135,6 +135,7 @@ export default class FilterParser {
|
|||||||
path: skipPrefix,
|
path: skipPrefix,
|
||||||
fullName,
|
fullName,
|
||||||
fieldName,
|
fieldName,
|
||||||
|
fieldPath: `${this.collection.name}.${fullName}`,
|
||||||
model: this.model,
|
model: this.model,
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { Op } from 'sequelize';
|
|
||||||
import moment, { MomentInput } from 'moment';
|
import moment, { MomentInput } from 'moment';
|
||||||
|
import { Op } from 'sequelize';
|
||||||
function stringToDate(value: string): Date {
|
function stringToDate(value: string): Date {
|
||||||
return moment(value).toDate();
|
return moment(value).toDate();
|
||||||
}
|
}
|
||||||
@ -9,7 +9,9 @@ function getNextDay(value: MomentInput): Date {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
$dateOn(value) {
|
$dateOn(value, ctx) {
|
||||||
|
// const field = ctx.db.getFieldByPath(ctx.fieldPath);
|
||||||
|
// console.log(field.isDateOnly());
|
||||||
return {
|
return {
|
||||||
[Op.and]: [{ [Op.gte]: stringToDate(value) }, { [Op.lt]: getNextDay(value) }],
|
[Op.and]: [{ [Op.gte]: stringToDate(value) }, { [Op.lt]: getNextDay(value) }],
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user