Skip to content

Commit

Permalink
UIHAADM-69: Adjust date picker
Browse files Browse the repository at this point in the history
  • Loading branch information
mkuklis committed Nov 21, 2023
1 parent 2f81b41 commit c74eb3d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
14 changes: 6 additions & 8 deletions src/search/renderDateFilterPair.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import { omit } from 'lodash';
import { Accordion, FilterAccordionHeader, Datepicker } from '@folio/stripes/components';
import { deparseFilters } from '@folio/stripes/smart-components';

Expand All @@ -14,17 +15,14 @@ function renderSingleDateFilter(intl, filterStruct, updateQuery, field, boundary
return (
<Datepicker
label={intl.formatMessage({ id: `ui-harvester-admin.filter.date.${field}.${boundary}` })}
backendDateStandard="YYYY-MM-DD"
value={value}
onChange={(e) => {
const isoDateTime = e.target.value;
if (isoDateTime === '') {
// This can happen when navigating away to Settings then hitting the back button.
// I have no idea why doing so activates the click-handler, but it does.
// In this case, we will not break the query string by setting the empty value into it.
return;
}
const isoDate = isoDateTime.substring(0, 10);
const fs2 = { ...filterStruct, [keyString]: [isoDate] };
const fs2 = (!isoDateTime) ?
omit(filterStruct, keyString) :
{ ...filterStruct, [keyString]: [e.target.value] };

updateQuery({ filters: deparseFilters(fs2) });
}}
useInput
Expand Down
2 changes: 1 addition & 1 deletion src/views/Jobs/Jobs.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ function Jobs({
<Paneset id="jobs-paneset">
<JobsSearchPane
{...sasqParams}
defaultWidth="20%"
defaultWidth="25%"
query={query}
updateQuery={updateQuery}
/>
Expand Down

0 comments on commit c74eb3d

Please sign in to comment.