Skip to content

Commit 3fb1609

Browse files
authored
206 modify time facet not working properly (#213)
* add date time picker * has to switch to date range because date picker doesn't work
1 parent 61b5f3a commit 3fb1609

File tree

3 files changed

+45
-15
lines changed

3 files changed

+45
-15
lines changed

frontend/src/components/search/Search.tsx

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, {useState} from "react";
2-
import {DataSearch, MultiDropdownList, ReactiveList, SingleDropdownRange} from "@appbaseio/reactivesearch";
2+
import {DataSearch, DateRange, MultiDropdownList, ReactiveList, SingleDropdownRange} from "@appbaseio/reactivesearch";
33
import {FormControlLabel, Grid, Switch, Typography} from "@mui/material";
44
import Layout from "../Layout";
55
import {SearchResult} from "./SearchResult";
@@ -107,28 +107,33 @@ export function Search() {
107107
<SingleDropdownRange
108108
componentId="downloadfilter"
109109
dataField="download"
110-
data={[{start: 0, label: "0 time and up"},
111-
{start: 10, label: "10 times and up"},
110+
data={[
111+
{start: 0, label: "Download Times: All"},
112+
{start: 10, label: "10 time and up"},
112113
{start: 100, label: "100 times and up"},
114+
{start: 1000, label: "1000 times and up"},
113115
]}
114-
placeholder="Download Times: All"
115116
innerClass={{
116117
select: "filter-select"
117118
}}
119+
defaultValue={"Download Times: All"}
118120
/>
119121
</Grid>
120122
<Grid item xs={12} sm={4} md={4} lg={4}>
121-
<SingleDropdownRange
123+
<DateRange
122124
componentId="modifyfilter"
123-
dataField="modified"
124-
data={[{start: 0, label: "0 time and up"},
125-
{start: 10, label: "10 times and up"},
126-
{start: 100, label: "100 times and up"},
127-
128-
]}
129-
placeholder="Modify Times: All"
130-
innerClass={{
131-
select: "filter-select"
125+
dataField="created"
126+
focused={false}
127+
autoFocusEnd={true}
128+
numberOfMonths={1}
129+
queryFormat="date_time_no_millis"
130+
showClear={true}
131+
showFilter={true}
132+
filterLabel="Date"
133+
URLParams={false}
134+
placeholder={{
135+
start: "From Date",
136+
end: "To Date"
132137
}}
133138
/>
134139
</Grid>

frontend/src/styles/main.css

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,30 @@ body {
105105
font-weight: bold;
106106
}
107107

108+
.DayPickerInput{
109+
border-radius: 0;
110+
border-bottom: 1px solid #868E96!important;
111+
}
112+
113+
.DayPickerInput > input{
114+
font-weight: bold;
115+
background:transparent!important;
116+
}
117+
118+
.DayPickerInput > input::placeholder { /* Chrome, Firefox, Opera, Safari 10.1+ */
119+
color: #424242;
120+
opacity: 1; /* Firefox */
121+
}
122+
123+
.DayPickerInput-OverlayWrapper{
124+
font-size:16px;
125+
}
126+
127+
[class*="-DateContainer-DateContainer"] > div:first-of-type > div{
128+
border: none!important;
129+
background: transparent!important;
130+
}
131+
108132
mark{
109133
font-weight: bold;
110134
background: inherit;

frontend/src/utils/common.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ export function dataURItoFile(dataURI) {
6161
}
6262

6363
export function parseDate(dateString) {
64-
const options = { year: "numeric", month: "short", day: "numeric", hour: "2-digit", minute: "2-digit" };
64+
const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
65+
const options = { year: "numeric", month: "short", day: "numeric", hour: "2-digit", minute: "2-digit" , timeZone: timeZone };
6566
const mydate = new Date(dateString);
6667
return mydate.toLocaleString("en-US", options);
6768
}

0 commit comments

Comments
 (0)