Skip to content

Commit

Permalink
ISSUE #4639 - use v5 datepicker to fix big where date reverts to old …
Browse files Browse the repository at this point in the history
…value on cancel
  • Loading branch information
The-Daniel committed Jan 19, 2024
1 parent b68eef2 commit 7662e09
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,11 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { ComponentType, useEffect } from 'react';
import { DatePickerProps } from '@mui/lab/DatePicker';
import { DateTimePickerProps } from '@mui/lab/DateTimePicker';
import { useEffect } from 'react';
import { TextField } from '@mui/material';
import { useState } from 'react';
import { StyledDatePicker, StyledDateTimePicker } from './dateField.styles';
import { DateTimePicker } from '@controls/inputs/datePicker/dateTimePicker.component';
import { DatePicker } from '@controls/inputs/datePicker/datePicker.component';

interface IProps {
value?: any;
Expand Down Expand Up @@ -48,7 +47,7 @@ export const DateField = ({
...dateFieldProps
}: IProps) => {
const [value, setValue] = useState(propValue || null);
const Picker: ComponentType<DatePickerProps | DateTimePickerProps> = dateTime ? StyledDateTimePicker : StyledDatePicker;
const Picker = dateTime ? DateTimePicker : DatePicker;

const handleAccept = (newValue) => {
if (newValue) {
Expand Down Expand Up @@ -78,11 +77,13 @@ export const DateField = ({
defaultValue={defaultValue}
name={name}
onBlur={onBlur}
className={className}
{...props}
InputProps={{ endAdornment: null }}
/>
)}
className={className}
{...dateFieldProps}
components={{ ActionBar: null }}
/>
);
};
32 changes: 0 additions & 32 deletions frontend/src/v4/routes/components/dateField/dateField.styles.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type ICalendarActionBar = {
export const CalendarActionBar = ({ onClear, hidden }: ICalendarActionBar) => {
if (hidden) return null;
return (
<ClearDateAction onClick={onClear} hidden={hidden}>
<ClearDateAction onClick={onClear}>
<FormattedMessage id="datePicker.actionBar.clear" defaultMessage="Clear date" />
</ClearDateAction>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,14 @@ export default css`
}
${SequenceDateContainer} {
width: 190px;
${SequenceDateField} {
${SequenceDateField} { // HERE
outline: 1px solid peru;
.MuiInputBase-root {
outline: 1px solid hotpink;
margin: 0px;
input {
outline: 1px solid lightgoldenrodyellow;
color: ${({ theme }) => theme.palette.secondary.main};
box-sizing: border-box;
width: 184px;
Expand Down

0 comments on commit 7662e09

Please sign in to comment.