|
|
@@ -1,4 +1,4 @@
|
|
|
-import { parse, addMinutes, isValid } from 'date-fns';
|
|
|
+import { parseISO, addMinutes, isValid } from 'date-fns';
|
|
|
import express, { Request, Router } from 'express';
|
|
|
import rateLimit from 'express-rate-limit';
|
|
|
import { query } from 'express-validator';
|
|
|
@@ -48,6 +48,8 @@ module.exports = (crowi: Crowi): Router => {
|
|
|
try {
|
|
|
const parsedSearchFilter = JSON.parse(req.query.searchFilter as string);
|
|
|
|
|
|
+ console.log(parsedSearchFilter);
|
|
|
+
|
|
|
// add username to query
|
|
|
const canContainUsernameFilterToQuery = parsedSearchFilter.usernames.every(u => typeof u === 'string');
|
|
|
if (canContainUsernameFilterToQuery && parsedSearchFilter.usernames.length > 0) {
|
|
|
@@ -61,8 +63,8 @@ module.exports = (crowi: Crowi): Router => {
|
|
|
}
|
|
|
|
|
|
// add date to query
|
|
|
- const startDate = parse(parsedSearchFilter.dates.startDate, 'yyyy/MM/dd', new Date());
|
|
|
- const endDate = parse(parsedSearchFilter.dates.endDate, 'yyyy/MM/dd', new Date());
|
|
|
+ const startDate = parseISO(parsedSearchFilter.dates.startDate);
|
|
|
+ const endDate = parseISO(parsedSearchFilter.dates.endDate);
|
|
|
if (isValid(startDate) && isValid(endDate)) {
|
|
|
Object.assign(query, {
|
|
|
createdAt: {
|