Skip to content

Commit

Permalink
Merge branch 'develop' into release/3.12.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Waldstein authored and Jon Waldstein committed May 14, 2024
2 parents 264c10c + 712b358 commit a97ce17
Showing 1 changed file with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,15 @@ export default ({

const popoverRef = useRef();

const [date, setDate] = useState<string>(value);
const [date, setDate] = useState<string>(value || new Date().toISOString().slice(0, 19));
const [isVisible, setIsVisible] = useState<boolean>(false);

const convertJsDateToMySQLDate = (dateTime: string) => {
const [date, time] = dateTime.split('T');
return `${date} ${time}`;
};

const toggleVisible = () => {
setIsVisible((state) => !state);
};

const onSelectDate = () => {
onSelect(convertJsDateToMySQLDate(date));
onSelect(date.replace('T', ' '));
setIsVisible(false);
};

Expand Down Expand Up @@ -99,15 +94,15 @@ export default ({
{showTimeSelector ? (
<DateTimePicker
is12Hour={is12Hour}
currentDate={value}
currentDate={date}
isInvalidDate={(date) => checkDate(date)}
onChange={(date) => {
setDate(date);
}}
/>
) : (
<DatePicker
currentDate={value}
currentDate={date}
isInvalidDate={(date) => checkDate(date)}
onChange={(date) => {
setDate(date);
Expand Down

0 comments on commit a97ce17

Please sign in to comment.