Compare commits

...

2 Commits

Author SHA1 Message Date
katherinehhh
9a0b43f50c fix: bug 2025-06-30 00:11:41 -07:00
katherinehhh
6ed84439a3 fix: bug 2025-06-29 21:41:00 -07:00
2 changed files with 13 additions and 9 deletions

View File

@ -33,7 +33,7 @@ const toDate = (date, options: any = {}) => {
}
if (field.constructor.name === 'DateOnlyField') {
val = moment(val).format('YYYY-MM-DD HH:mm:ss');
val = moment.utc(val).format('YYYY-MM-DD HH:mm:ss');
}
const eventObj = {
@ -53,13 +53,13 @@ function parseDateTimezone(ctx) {
return ctx.db.options.timezone;
}
// if (field.constructor.name === 'DatetimeNoTzField') {
// return '+00:00';
// }
if (field.constructor.name === 'DatetimeNoTzField') {
return '+00:00';
}
// if (field.constructor.name === 'DateOnlyField') {
// return '+00:00';
// }
if (field.constructor.name === 'DateOnlyField') {
return '+00:00';
}
return ctx.db.options.timezone;
}
@ -69,7 +69,6 @@ export default {
const r = parseDate(value, {
timezone: parseDateTimezone(ctx),
});
if (typeof r === 'string') {
return {
[Op.eq]: toDate(r, { ctx }),
@ -77,6 +76,9 @@ export default {
}
if (Array.isArray(r)) {
console.log(11111111, {
[Op.and]: [{ [Op.gte]: toDate(r[0], { ctx }) }, { [Op.lt]: toDate(r[1], { ctx }) }],
});
return {
[Op.and]: [{ [Op.gte]: toDate(r[0], { ctx }) }, { [Op.lt]: toDate(r[1], { ctx }) }],
};

View File

@ -188,9 +188,11 @@ export const parseFilter = async (filter: any, opts: ParseFilterOptions = {}) =>
const field = getField?.(path);
if (field?.constructor.name === 'DateOnlyField' || field?.constructor.name === 'DatetimeNoTzField') {
if (value.type) {
return getDayRangeByParams({ ...value, timezone: field?.timezone || timezone });
}
return value;
}
return dateValueWrapper(value, field?.timezone || timezone);
}
return value;