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