Skip to content

Commit 63cdfb4

Browse files
authored
Move timestamps to ISO strings in lists (#1401)
1 parent a1887b6 commit 63cdfb4

File tree

3 files changed

+53
-24
lines changed

3 files changed

+53
-24
lines changed

frontend/src/modules/dashboard/components/dashboard-members.vue

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@
9898
query: filterQueryService().setQuery({
9999
...allMembers.filter,
100100
joinedDate: {
101-
value: periodStartDate,
102-
operator: 'gt',
101+
value: periodRange,
102+
operator: 'between',
103103
},
104104
}),
105105
}"
@@ -186,8 +186,8 @@
186186
query: filterQueryService().setQuery({
187187
...allMembers.filter,
188188
lastActivityDate: {
189-
value: periodStartDate,
190-
operator: 'gt',
189+
value: periodRange,
190+
operator: 'between',
191191
},
192192
}),
193193
}"
@@ -252,11 +252,16 @@ export default {
252252
'members',
253253
'period',
254254
]),
255-
periodStartDate() {
256-
return moment()
257-
.utc()
258-
.subtract(this.period.value, 'day')
259-
.format('YYYY-MM-DD');
255+
periodRange() {
256+
return [
257+
moment()
258+
.utc()
259+
.subtract(this.period.value - 1, 'day')
260+
.format('YYYY-MM-DD'),
261+
moment()
262+
.utc()
263+
.format('YYYY-MM-DD'),
264+
];
260265
},
261266
},
262267
methods: {

frontend/src/modules/dashboard/components/dashboard-organizations.vue

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
No new organizations during this period
7373
</app-dashboard-empty-state>
7474
<div
75-
v-if="organizations.length >= 5"
75+
v-if="recentOrganizations.length >= 5"
7676
class="pt-3"
7777
>
7878
<router-link
@@ -81,8 +81,8 @@
8181
query: filterQueryService().setQuery({
8282
...allOrganizations.filter,
8383
joinedDate: {
84-
value: periodStartDate,
85-
operator: 'gt',
84+
value: periodRange,
85+
operator: 'between',
8686
},
8787
}),
8888
}"
@@ -161,8 +161,8 @@
161161
query: filterQueryService().setQuery({
162162
...allOrganizations.filter,
163163
lastActivityDate: {
164-
value: periodStartDate,
165-
operator: 'gt',
164+
value: periodRange,
165+
operator: 'between',
166166
},
167167
}),
168168
}"
@@ -224,10 +224,16 @@ export default {
224224
'organizations',
225225
'period',
226226
]),
227-
periodStartDate() {
228-
return moment()
229-
.subtract(this.period.value, 'day')
230-
.format('YYYY-MM-DD');
227+
periodRange() {
228+
return [
229+
moment()
230+
.utc()
231+
.subtract(this.period.value - 1, 'day')
232+
.format('YYYY-MM-DD'),
233+
moment()
234+
.utc()
235+
.format('YYYY-MM-DD'),
236+
];
231237
},
232238
},
233239
methods: {

frontend/src/shared/modules/filters/config/apiFilterRenderer/date.filter.renderer.ts

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,18 @@ export const dateApiFilterRenderer = (property: string, { value, operator }: Dat
1212
filterOperator = FilterDateOperator.BETWEEN;
1313
}
1414

15-
let filter = {
16-
[property]: {
17-
[filterOperator]: value,
18-
},
19-
};
20-
if ([FilterDateOperator.EQ, FilterDateOperator.NE].includes(operator)) {
15+
let filter;
16+
17+
if ([FilterDateOperator.BETWEEN, FilterDateOperator.NOT_BETWEEN].includes(operator)) {
18+
filter = {
19+
[property]: {
20+
[filterOperator]: [
21+
moment.utc(value[0]).startOf('day').toISOString(),
22+
moment.utc(value[1]).endOf('day').toISOString(),
23+
],
24+
},
25+
};
26+
} else if ([FilterDateOperator.EQ, FilterDateOperator.NE].includes(operator)) {
2127
filter = {
2228
[property]: {
2329
between: [
@@ -26,6 +32,18 @@ export const dateApiFilterRenderer = (property: string, { value, operator }: Dat
2632
],
2733
},
2834
};
35+
} else {
36+
let parsedValue = moment.utc(value).startOf('day').toISOString();
37+
38+
if ([FilterDateOperator.GT].includes(operator)) {
39+
parsedValue = moment.utc(value).endOf('day').toISOString();
40+
}
41+
42+
filter = {
43+
[property]: {
44+
[filterOperator]: parsedValue,
45+
},
46+
};
2947
}
3048

3149
return [

0 commit comments

Comments
 (0)