fix(filters): invalid filter range when converting dates to strings
Resolves https://community.vikunja.io/t/my-vikunja-instance-creates-tasks-with-due-date-time-of-9am-for-tasks-with-the-word-today-word-in-it/2105/10
This commit is contained in:
parent
3f380e0d61
commit
85fb8e3443
@ -4,7 +4,7 @@ import TaskModel from '@/models/task'
|
|||||||
import type {ITask} from '@/modelTypes/ITask'
|
import type {ITask} from '@/modelTypes/ITask'
|
||||||
|
|
||||||
export interface TaskFilterParams {
|
export interface TaskFilterParams {
|
||||||
sort_by: ('start_date' | 'done' | 'id' | 'position' | 'kanban_position')[],
|
sort_by: ('start_date' | 'end_date' | 'due_date' | 'done' | 'id' | 'position' | 'kanban_position')[],
|
||||||
order_by: ('asc' | 'desc')[],
|
order_by: ('asc' | 'desc')[],
|
||||||
filter: string,
|
filter: string,
|
||||||
filter_include_nulls: boolean,
|
filter_include_nulls: boolean,
|
||||||
|
@ -173,7 +173,7 @@ function setShowNulls(show: boolean) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
async function loadPendingTasks(from: string, to: string) {
|
async function loadPendingTasks(from: Date|string, to: Date|string) {
|
||||||
// FIXME: HACK! This should never happen.
|
// FIXME: HACK! This should never happen.
|
||||||
// Since this route is authentication only, users would get an error message if they access the page unauthenticated.
|
// Since this route is authentication only, users would get an error message if they access the page unauthenticated.
|
||||||
// Since this component is mounted as the home page before unauthenticated users get redirected
|
// Since this component is mounted as the home page before unauthenticated users get redirected
|
||||||
@ -187,16 +187,18 @@ async function loadPendingTasks(from: string, to: string) {
|
|||||||
order_by: ['asc', 'desc'],
|
order_by: ['asc', 'desc'],
|
||||||
filter: 'done = false',
|
filter: 'done = false',
|
||||||
filter_include_nulls: showNulls,
|
filter_include_nulls: showNulls,
|
||||||
|
s: '',
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!showAll.value) {
|
if (!showAll.value) {
|
||||||
params.filter += ` && due_date < '${to}'`
|
|
||||||
|
params.filter += ` && due_date < '${to instanceof Date ? to.toISOString() : to}'`
|
||||||
|
|
||||||
// NOTE: Ideally we could also show tasks with a start or end date in the specified range, but the api
|
// NOTE: Ideally we could also show tasks with a start or end date in the specified range, but the api
|
||||||
// is not capable (yet) of combining multiple filters with 'and' and 'or'.
|
// is not capable (yet) of combining multiple filters with 'and' and 'or'.
|
||||||
|
|
||||||
if (!showOverdue) {
|
if (!showOverdue) {
|
||||||
params.filter += ` && due_date > '${from}'`
|
params.filter += ` && due_date > '${from instanceof Date ? from.toISOString() : from}'`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user